summaryrefslogtreecommitdiffstats
path: root/xlators/features/cloudsync/src/cloudsync-plugins/src/cvlt/src/libcvlt.h
blob: c45ac948f6ce6447beab6dd47199b2f446206737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
  Copyright (c) 2018 Commvault Systems, Inc. <http://www.commvault.com>
  This file is part of GlusterFS.

  This file is licensed to you under your choice of the GNU Lesser
  General Public License, version 3 or any later version (LGPLv3 or
  later), or the GNU General Public License, version 2 (GPLv2), in all
  cases as published by the Free Software Foundation.
*/
#ifndef _LIBCVLT_H
#define _LIBCVLT_H

#include <semaphore.h>
#include <glusterfs/xlator.h>
#include <glusterfs/glusterfs.h>
#include <glusterfs/call-stub.h>
#include <glusterfs/syncop.h>
#include <glusterfs/compat-errno.h>
#include "cloudsync-common.h"
#include "libcvlt-mem-types.h"
#include "archivestore.h"

enum _cvlt_op {
    CVLT_READ_OP = 1,
    CVLT_WRITE_OP = 2,
    CVLT_RESTORE_OP = 3,
    CVLT_ARCHIVE_OP = 4,
    CVLT_LOOKUP_OP = 5,
    CVLT_XATTR_OP = 6,
    CVLT_STAT_OP = 7,
    CVLT_FSTAT_op = 8,
    CVLT_UNDEF_OP = 127
};
typedef enum _cvlt_op cvlt_op_t;

struct _archive;
struct _cvlt_request {
    uint64_t offset;
    uint64_t bytes;
    struct iobuf *iobuf;
    struct iobref *iobref;
    call_frame_t *frame;
    cvlt_op_t op_type;
    int32_t op_ret;
    int32_t op_errno;
    xlator_t *this;
    sem_t sem;
    archstore_info_t store_info;
    archstore_fileinfo_t file_info;
    cs_size_xattr_t szxattr;
};
typedef struct _cvlt_request cvlt_request_t;

struct _archive {
    gf_lock_t lock;                /* lock for controlling access   */
    xlator_t *xl;                  /* xlator                        */
    void *handle;                  /* handle returned from dlopen   */
    int32_t nreqs;                 /* num requests active           */
    struct mem_pool *req_pool;     /* pool for requests             */
    struct iobuf_pool *iobuf_pool; /* iobuff pool                   */
    archstore_desc_t descinfo;     /* Archive store descriptor info */
    archstore_methods_t fops;      /* function pointers             */
    char *product_id;
    char *store_id;
    char *trailer;
};
typedef struct _archive archive_t;

void *
cvlt_init(xlator_t *);

int
cvlt_reconfigure(xlator_t *, dict_t *);

void
cvlt_fini(void *);

int
cvlt_download(call_frame_t *, void *);

int
cvlt_read(call_frame_t *, void *);

#endif