Minor File interface changes.

These are intended to make the sample file writing easier.
This commit is contained in:
Scott Lamb
2016-01-06 23:38:46 -08:00
parent 7b45f48027
commit a46df2c2e5
3 changed files with 20 additions and 7 deletions

View File

@@ -65,9 +65,15 @@ class File {
// Already closed is considered a success.
virtual int Close() = 0;
// fsync(), returning 0 on success or errno>0 on failure.
virtual int Sync() = 0;
// ftruncate(), returning 0 on success or errno>0 on failure.
virtual int Truncate(off_t length) = 0;
// Write to the file, returning 0 on success or errno>0 on failure.
// On success, data->remove_prefix will be called with the written bytes.
virtual int Write(re2::StringPiece *data) = 0;
// On success, |bytes_written| will be updated.
virtual int Write(re2::StringPiece data, size_t *bytes_written) = 0;
};
// Interface to the local filesystem. There's typically one per program,