net_instaweb::StdioFileSystem Class Reference

Inheritance diagram for net_instaweb::StdioFileSystem:
net_instaweb::FileSystem

List of all members.

Public Member Functions

virtual int MaxPathLength (const StringPiece &base) const
virtual InputFileOpenInputFile (const char *filename, MessageHandler *message_handler)
virtual OutputFileOpenOutputFileHelper (const char *filename, MessageHandler *message_handler)
virtual OutputFileOpenTempFileHelper (const StringPiece &prefix_name, MessageHandler *message_handle)
virtual bool ListContents (const StringPiece &dir, StringVector *files, MessageHandler *handler)
virtual bool MakeDir (const char *directory_path, MessageHandler *handler)
virtual bool RemoveFile (const char *filename, MessageHandler *handler)
 Like POSIX 'rm'.
virtual bool RenameFileHelper (const char *old_file, const char *new_file, MessageHandler *handler)
virtual bool Atime (const StringPiece &path, int64 *timestamp_sec, MessageHandler *handler)
virtual bool Mtime (const StringPiece &path, int64 *timestamp_sec, MessageHandler *handler)
 Modified time. Time the file contents were modified.
virtual bool Size (const StringPiece &path, int64 *size, MessageHandler *handler)
virtual BoolOrError Exists (const char *path, MessageHandler *handler)
 Like POSIX 'test -e', checks if path exists (is a file, directory, etc.).
virtual BoolOrError IsDir (const char *path, MessageHandler *handler)
 Like POSIX 'test -d', checks if path exists and refers to a directory.
virtual BoolOrError TryLock (const StringPiece &lock_name, MessageHandler *handler)
virtual bool Unlock (const StringPiece &lock_name, MessageHandler *handler)
InputFileStdin ()
OutputFileStdout ()
OutputFileStderr ()

Member Function Documentation

virtual bool net_instaweb::StdioFileSystem::Atime ( const StringPiece &  path,
int64 *  timestamp_sec,
MessageHandler handler 
) [virtual]

Stores in *timestamp_sec the timestamp (in seconds since the epoch) of the last time the file was accessed (through one of our Read methods, or by someone else accessing the filesystem directly). Returns true on success, false on failure.

Todo:
TODO(abliss): replace this with a single Stat() function.

Implements net_instaweb::FileSystem.

virtual bool net_instaweb::StdioFileSystem::ListContents ( const StringPiece &  dir,
StringVector *  files,
MessageHandler handler 
) [virtual]

Like POSIX 'ls -a', lists all files and directories under the given directory (but omits "." and ".."). Full paths (not just filenames) will be pushed onto the back of the supplied vector (without clearing it). Returns true on success (even if the dir was empty), false on error (even if some files were pushed onto the vector). This is generally not threadsafe! Use a mutex.

Implements net_instaweb::FileSystem.

virtual bool net_instaweb::StdioFileSystem::MakeDir ( const char *  directory_path,
MessageHandler handler 
) [virtual]

Like POSIX 'mkdir', makes a directory only if parent directory exists. Fails if directory_name already exists or parent directory doesn't exist.

Implements net_instaweb::FileSystem.

virtual int net_instaweb::StdioFileSystem::MaxPathLength ( const StringPiece &  base  )  const [virtual]

Returns the maximum possible length of a path in a given directory. Note that this is the total, and there may be further constraints on each level. It also depends on the base path.

Default implementation defensively returns 8192.

Reimplemented from net_instaweb::FileSystem.

virtual OutputFile* net_instaweb::StdioFileSystem::OpenOutputFileHelper ( const char *  filename,
MessageHandler handler 
) [virtual]

These interfaces must be defined by implementers of FileSystem. They may assume the directory already exists.

Implements net_instaweb::FileSystem.

virtual bool net_instaweb::StdioFileSystem::Size ( const StringPiece &  path,
int64 *  size,
MessageHandler handler 
) [virtual]

Given a file, computes its size in bytes and store it in *size. Returns true on success, false on failure. Behavior is undefined if path refers to a directory.

Todo:
TODO(abliss): replace this with a single Stat() function.

Implements net_instaweb::FileSystem.

virtual BoolOrError net_instaweb::StdioFileSystem::TryLock ( const StringPiece &  lock_name,
MessageHandler handler 
) [virtual]

Attempts to obtain a global (cross-process, cross-thread) lock of the given name (which should be a valid filename, not otherwise used, in an extant directory). If someone else has this lock, returns False immediately. If anything goes wrong, returns Error. On success, returns True: then you must call Unlock when you are done.

Implements net_instaweb::FileSystem.

virtual bool net_instaweb::StdioFileSystem::Unlock ( const StringPiece &  lock_name,
MessageHandler handler 
) [virtual]

Attempts to release a lock previously obtained through TryLock. If your thread did not prevously obtain the lock, the behavior is undefined. Returns true if we successfully release the lock. Returns false if we were unable to release the lock (e.g. somebody came along and write-protected the lockfile). You might try again, or start using a different lock name.

Implements net_instaweb::FileSystem.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:20 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3