CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sink.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_NETWORK_SINK_H_
6 #define CVMFS_NETWORK_SINK_H_
7 
8 #include <stdint.h>
9 #include <string>
10 
11 namespace cvmfs {
12 
17 class Sink {
18  protected:
19  explicit Sink(bool is_owner) : is_owner_(is_owner) { }
20 
21  public:
22  virtual ~Sink() { }
29  virtual int64_t Write(const void *buf, uint64_t sz) = 0;
30 
37  virtual int Reset() = 0;
38 
48  virtual int Purge() = 0;
49 
53  virtual bool IsValid() = 0;
54 
58  void Release() { is_owner_ = false; }
59 
65  virtual int Flush() = 0;
66 
83  virtual bool Reserve(size_t size) = 0;
84 
91  virtual bool RequiresReserve() = 0;
92 
96  virtual std::string Describe() = 0;
97 
98  protected:
99  bool is_owner_;
100 };
101 
102 } // namespace cvmfs
103 
104 #endif // CVMFS_NETWORK_SINK_H_
virtual int Purge()=0
virtual bool RequiresReserve()=0
virtual std::string Describe()=0
virtual bool IsValid()=0
void Release()
Definition: sink.h:58
virtual int Reset()=0
Sink(bool is_owner)
Definition: sink.h:19
virtual int Flush()=0
virtual bool Reserve(size_t size)=0
static void size_t size
Definition: smalloc.h:54
virtual ~Sink()
Definition: sink.h:22
bool is_owner_
Definition: sink.h:99
virtual int64_t Write(const void *buf, uint64_t sz)=0