source: box/trunk/lib/common/ReadLoggingStream.h @ 2245

Revision 2245, 1.5 KB checked in by chris, 4 years ago (diff)

Pass a RunStatusProvider? and a ReadLoggingStream::Logger from
BackupDaemon? through BackupClientDirectoryRecord?, BackupStoreFile? and
BackupStoreFileEncodeStream? to ReadLoggingStream?, to allow progress
callbacks during file upload and cancelling upload part-way.

Implement ReadLoggingStream::Logger in
BackupClientDirectoryRecord::SyncParams?, which thunks the notifications
back to the ProgressNotifier?.

Add the SysadminNotifier? interface from Boxi.

Add NotifyIDMapsSetup() to ProgressNotifier?.

Change BackupClientDirectoryRecord::SyncParams? to store references to
the individual callback interfaces rather than BackupDaemon?.

Initialise all members in BackupDaemon?.

Add ability for BackupDaemon? user to override the ProgressNotifier?,
LocationResolver?, SysadminNotifier? and RunStatusProvider? that will be
used during the backup.

Make BackupDaemon::Location class public and provide access to the
configured locations for Boxi (dangerous, they could be modified without
BackupDaemon? knowing it).

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    ReadLoggingStream.h
5//              Purpose: Wrapper around IOStreams that logs read progress
6//              Created: 2007/01/16
7//
8// --------------------------------------------------------------------------
9
10#ifndef READLOGGINGSTREAM__H
11#define READLOGGINGSTREAM__H
12
13#include "IOStream.h"
14#include "BoxTime.h"
15
16class ReadLoggingStream : public IOStream
17{
18public:
19        class Logger
20        {
21        public:
22                virtual ~Logger() { }
23                virtual void Log(int64_t readSize, int64_t offset,
24                        int64_t length, box_time_t elapsed,
25                        box_time_t finish) = 0;
26                virtual void Log(int64_t readSize, int64_t offset,
27                        int64_t length) = 0;
28                virtual void Log(int64_t readSize, int64_t offset) = 0;
29        };
30
31private:
32        IOStream& mrSource;
33        IOStream::pos_type mOffset, mLength, mTotalRead;
34        box_time_t mStartTime;
35        Logger& mrLogger;
36
37public:
38        ReadLoggingStream(IOStream& rSource, Logger& rLogger);
39       
40        virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
41        virtual pos_type BytesLeftToRead();
42        virtual void Write(const void *pBuffer, int NBytes);
43        virtual pos_type GetPosition() const;
44        virtual void Seek(IOStream::pos_type Offset, int SeekType);
45        virtual void Close();
46       
47        virtual bool StreamDataLeft();
48        virtual bool StreamClosed();
49
50private:
51        ReadLoggingStream(const ReadLoggingStream &rToCopy) 
52        : mrSource(rToCopy.mrSource), mrLogger(rToCopy.mrLogger)
53        { /* do not call */ }
54};
55
56#endif // READLOGGINGSTREAM__H
57
58
Note: See TracBrowser for help on using the repository browser.