2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
5 * WvSyncFile provides the WvSyncObj implementation necessarily to
6 * conduct librsync operations on a standard file.
8 * Note that I use the regular ::open() and ::read() calls, rather than
9 * using WvFile, because I don't need or particularly want the buffer, and
10 * I need to be able to lseek().
13 #ifndef __WVSYNCFILE_H
14 #define __WVSYNCFILE_H
16 #include "wvsyncobj.h"
18 class WvSyncFile
: public WvSyncObj
21 WvSyncFile(WvStringParm _name
, WvStringParm _rootdir
);
23 virtual bool isok() const
26 virtual time_t findlastmodtime() const;
28 /** metadata for WvSyncFile looks like this:
29 * mode uidname uid gidname gid
31 * 49152:dcoombs:1000:weaver:4242
33 virtual WvString
findmeta();
34 virtual void applymeta(WvStringParm newmeta
, time_t newmtime
);
36 /** override isunchanged() to accommodate symlinks, where you can't
39 virtual bool isunchanged(time_t sometime
, WvStringParm somemeta
) const;
41 /** issyncable() should return true for a regular file, a symlink, or a
42 * directory, and false for everything else. If the file doesn't
43 * exist, we can still sync it down, so check for that too.
45 virtual bool issyncable() const
46 { return S_ISREG(mode
) || S_ISLNK(mode
) || S_ISDIR(mode
) || mode
<0; }
48 virtual void makecopy(WvStringParm newname
) const;
50 virtual bool isdir() const;
51 virtual bool isdir(WvStringParm somemeta
) const;
53 virtual bool installnew(WvStringParm fname
, WvStringParm newmeta
,
68 virtual bool getdata(WvBuf
&out
, off_t ofs
, size_t size
);
70 virtual off_t
approxsize() const;
72 WvString
realname() const
73 { return WvString("%s/%s", rootdir
, name
); }
76 #endif // __WVSYNCFILE_H