logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

ost::SharedFile - This class defines a database I/O file service that can be shared by multiple

Author

       Generated automatically by Doxygen for GNU CommonC++ from the source code.

GNU CommonC++                                    Sun Dec 27 2020                              ost::SharedFile(3)

Constructor & Destructor Documentation

ost::SharedFile::SharedFile(constchar*path)
       Open or create a new database file. You should also use Initial.

       Parameterspath pathname of database to open.

   ost::SharedFile::SharedFile(constSharedFile&file)
       Create a shared file as a duplicate of an existing shared file.

       Parametersfile original file.

   virtualost::SharedFile::~SharedFile()[virtual]
       Close and finish a database file.

Detailed Description

       This class defines a database I/O file service that can be shared by multiple processes.

       Each thread should access a dup of the database object, and mutex locks can be used to preserve
       transaction integrety if multiple threads are used.

       SharedFile is used when a database may be shared between multiple processes. SharedFile automatically
       applies low level byte-range 'file locks', and provides an interface to fetch and release byte-range
       locked portions of a file.

       Author
           David Sugar dyfet@ostel.com

       This class defines a database I/O file service that can be shared by multiple processes.

Member Function Documentation

Errorost::SharedFile::append(caddr_taddress=NULL,ccxx_size_tlength=0)
       Add new data to the end of the file. Locks file during append.

       Parametersaddress address to use, or NULL if same as last I/O.
           length length to use, or 0 if same as last I/O.

   Errorost::SharedFile::clear(ccxx_size_tlength=0,off_tpos=-1)
       Clear a lock held from a previous fetch operation without updating.

       Returns
           errSuccess on success.

       Parameterslength length to use, or 0 if same as last I/O.
           pos file position to use or -1 if same as last I/O.

   Errorost::SharedFile::fetch(caddr_taddress=NULL,ccxx_size_tlength=0,off_tposition=-1)
       Lock and Fetch a portion of the file into physical memory. This can use state information to fetch the
       current record multiple times.

       Returns
           errSuccess on success.

       Parametersaddress address to use, or NULL if same as last I/O.
           length length to use, or 0 if same as last I/O.
           position file position to use -1 if same as last I/O.

   off_tost::SharedFile::getPosition(void)
       Fetch the current file position marker for this thread.

       Returns
           file position offset.

   boolost::SharedFile::operator++(void)boolost::SharedFile::operator--(void)Errorost::SharedFile::restart(void)[inline],[virtual]
       Restart an existing database; close and re-open.

       Returns
           errSuccess if successful.

       Reimplemented from ost::RandomFile.

   Errorost::SharedFile::update(caddr_taddress=NULL,ccxx_size_tlength=0,off_tposition=-1)
       Update a portion of a file from physical memory. This can use state information to commit the last read
       record. The current lock is also cleared.

       Returns
           errSuccess on success.

       Parametersaddress address to use, or NULL if same as last I/O.
           length length to use, or 0 if same as last I/O.
           position file position to use or -1 if same as last I/O.

Name

       ost::SharedFile - This class defines a database I/O file service that can be shared by multiple
       processes.

Synopsis

       #include <file.h>

       Inherits ost::RandomFile.

   PublicMemberFunctionsSharedFile (const char *path)
           Open or create a new database file.
       SharedFile (const SharedFile &file)
           Create a shared file as a duplicate of an existing shared file.
       virtual ~SharedFile ()
           Close and finish a database file.
       Errorrestart (void)
           Restart an existing database; close and re-open.
       Errorfetch (caddr_t address=NULL, ccxx_size_t length=0, off_t position=-1)
           Lock and Fetch a portion of the file into physical memory.
       Errorupdate (caddr_t address=NULL, ccxx_size_t length=0, off_t position=-1)
           Update a portion of a file from physical memory.
       Errorclear (ccxx_size_t length=0, off_t pos=-1)
           Clear a lock held from a previous fetch operation without updating.
       Errorappend (caddr_t address=NULL, ccxx_size_t length=0)
           Add new data to the end of the file.
       off_t getPosition (void)
           Fetch the current file position marker for this thread.
       bool operator++ (void)
       bool operator-- (void)

   AdditionalInheritedMembers

See Also