GCC Code Coverage Report


Directory: cvmfs/
File: cvmfs/sink.h
Date: 2023-02-05 02:36:10
Exec Total Coverage
Lines: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /**
2 * This file is part of the CernVM File System.
3 */
4
5 #ifndef CVMFS_SINK_H_
6 #define CVMFS_SINK_H_
7
8 #include <stdint.h>
9
10 namespace cvmfs {
11
12 /**
13 * A data sink that behaves like a writable file descriptor with a custom
14 * implementation.
15 *
16 * Currently used by the Fetcher class to redirect writing into a cache manager.
17 *
18 * TODO(jblomer): can all download destinations be implemented by inheriting
19 * from this class?
20 */
21 class Sink {
22 public:
23 84 virtual ~Sink() { }
24 /**
25 * Appends data to the sink, returns the number of bytes written or -errno.
26 */
27 virtual int64_t Write(const void *buf, uint64_t sz) = 0;
28 /**
29 * Truncate all written data and start over at position zero.
30 */
31 virtual int Reset() = 0;
32 };
33
34 } // namespace cvmfs
35
36 #endif // CVMFS_SINK_H_
37