]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/stored/cloud_dev.h
Big backport from Enterprise
[bacula/bacula] / bacula / src / stored / cloud_dev.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2017 Kern Sibbald
5
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 /*
20  * Generic routines for writing Cloud Volumes
21  *
22  * Written by Kern Sibbald, May MMXVI
23  */
24
25 #ifndef _CLOUD_DEV_H_
26 #define _CLOUD_DEV_H_
27
28 #include "bacula.h"
29 #include "stored.h"
30 #include "cloud_driver.h"
31
32 class cloud_dev: public file_dev {
33 public:
34    int64_t obj_len;
35    int status;
36
37 public:
38    cloud_dev(JCR *jcr, DEVRES *device);
39    ~cloud_dev();
40
41    cloud_driver *driver;
42
43    /* DEVICE virtual interfaces that we redefine */
44    boffset_t lseek(DCR *dcr, off_t offset, int whence);
45    bool rewind(DCR *dcr);
46    bool reposition(DCR *dcr, uint64_t raddr);
47    bool open_device(DCR *dcr, int omode);
48    bool open_next_part(DCR *dcr);
49    bool truncate(DCR *dcr);
50    int  truncate_cache(DCR *dcr, const char *VolName, int64_t *size);
51    bool upload_cache(DCR *dcr, const char *VolName, POOLMEM *&err);
52    bool close(DCR *dcr);
53    bool update_pos(DCR *dcr);
54    bool is_eod_valid(DCR *dcr);
55    bool eod(DCR *dcr);
56    int read_dev_volume_label(DCR *dcr);
57    const char *print_type();
58    DEVICE *get_dev(DCR *dcr);
59    uint32_t get_hi_addr();
60    uint32_t get_low_addr();
61    uint64_t get_full_addr();
62    uint64_t get_full_addr(boffset_t addr);
63    char *print_addr(char *buf, int32_t buf_len);
64    char *print_addr(char *buf, int32_t maxlen, boffset_t addr);
65    bool do_size_checks(DCR *dcr, DEV_BLOCK *block);
66    bool write_volume_label(DCR *dcr,
67            const char *VolName, const char *PoolName,
68            bool relabel, bool no_prelabel);
69    bool rewrite_volume_label(DCR *dcr, bool recycle);
70    bool start_of_job(DCR *dcr);
71    bool end_of_job(DCR *dcr);
72    bool get_cloud_volumes_list(DCR* dcr, alist *volumes, POOLMEM *&err) { return driver->get_cloud_volumes_list(dcr, volumes, err); };
73    bool get_cloud_volume_parts_list(DCR *dcr, const char *VolumeName, ilist *parts, POOLMEM *&err) { return driver->get_cloud_volume_parts_list(dcr, VolumeName, parts, err);};
74    uint32_t get_cloud_upload_transfer_status(POOL_MEM &msg, bool verbose);
75    uint32_t get_cloud_download_transfer_status(POOL_MEM &msg, bool verbose);
76 };
77
78 #endif /* _CLOUD_DEV_H_ */