Documentation
¶
Index ¶
- type Cache
- type CachedRow
- type ContentCache
- type Key
- type MetadataCache
- func (cache *MetadataCache) Close() error
- func (cache *MetadataCache) GetDirEntries(inode uint64, outEntries *map[string]OneDirEntry) error
- func (cache *MetadataCache) GetFullEntry(path string) (*CachedRow, error)
- func (cache *MetadataCache) PutContentHash(inode uint64, contentHash Key) error
- func (cache *MetadataCache) PutDirEntries(inode uint64, path string, entries []os.FileInfo) error
- func (cache *MetadataCache) PutFileInfo(inode uint64, fileInfo os.FileInfo) error
- func (cache *MetadataCache) PutNewNoEntry(path string) (uint64, error)
- func (cache *MetadataCache) PutNewOrUpdateNoEntry(path string) error
- func (cache *MetadataCache) PutNewOrUpdateWithType(path string, fileMode os.FileMode) error
- func (cache *MetadataCache) PutNewWithType(path string, fileMode os.FileMode) (uint64, error)
- func (cache *MetadataCache) PutSymlinkTarget(inode uint64, target string) error
- type OneDirEntry
- type RetriableRow
- type RetriableStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { Metadata *MetadataCache Content *ContentCache }
Cache implements the unified cache.
type CachedRow ¶
type CachedRow struct { Inode uint64 TypeName string FileInfo *os.FileInfo DidReadDir bool DirEntries map[string]OneDirEntry ContentHash *Key Target *string }
CachedRow contains all the data for an inode as known by the cache.
type ContentCache ¶
type ContentCache struct {
// contains filtered or unexported fields
}
ContentCache implements the content cache.
func NewContentCache ¶
func NewContentCache(root string, syscalls real.Syscalls) *ContentCache
NewContentCache instantiates a new content cache.
func (*ContentCache) GetFileForContents ¶
func (cache *ContentCache) GetFileForContents(key Key) (string, error)
GetFileForContents returns the path to file containing the contents for the key.
func (*ContentCache) HasKey ¶
func (cache *ContentCache) HasKey(key Key) (bool, error)
HasKey checks if the given key is in the cache.
func (*ContentCache) PutContents ¶
func (cache *ContentCache) PutContents(path string) (Key, error)
PutContents stores the given file in the cache and returns the key.
func (*ContentCache) Root ¶
func (cache *ContentCache) Root() string
Root returns the path to the root of the cache.
type MetadataCache ¶
type MetadataCache struct {
// contains filtered or unexported fields
}
MetadataCache is a persistent database of the file system metadata for all known entries.
func NewMetadataCache ¶
func NewMetadataCache(path string) (*MetadataCache, error)
NewMetadataCache opens a new connection to the given database.
func (*MetadataCache) Close ¶
func (cache *MetadataCache) Close() error
Close terminates the connection to the database.
func (*MetadataCache) GetDirEntries ¶
func (cache *MetadataCache) GetDirEntries(inode uint64, outEntries *map[string]OneDirEntry) error
GetDirEntries reads the directory entries stored in an inode.
func (*MetadataCache) GetFullEntry ¶
func (cache *MetadataCache) GetFullEntry(path string) (*CachedRow, error)
GetFullEntry reads the full metadata for a file.
func (*MetadataCache) PutContentHash ¶
func (cache *MetadataCache) PutContentHash(inode uint64, contentHash Key) error
PutContentHash stores a new content hash for an existing inode.
func (*MetadataCache) PutDirEntries ¶
PutDirEntries stores a new set of directory entries for an existing inode.
func (*MetadataCache) PutFileInfo ¶
func (cache *MetadataCache) PutFileInfo(inode uint64, fileInfo os.FileInfo) error
PutFileInfo stores new file details for an existing inode.
func (*MetadataCache) PutNewNoEntry ¶
func (cache *MetadataCache) PutNewNoEntry(path string) (uint64, error)
PutNewNoEntry stores a new whiteout entry for the given path.
func (*MetadataCache) PutNewOrUpdateNoEntry ¶
func (cache *MetadataCache) PutNewOrUpdateNoEntry(path string) error
PutNewOrUpdateNoEntry stores a new whiteout entry or updates an existing one.
func (*MetadataCache) PutNewOrUpdateWithType ¶
func (cache *MetadataCache) PutNewOrUpdateWithType(path string, fileMode os.FileMode) error
PutNewOrUpdateWithType stores a new entry or updates an existing one to match the given type.
func (*MetadataCache) PutNewWithType ¶
PutNewWithType stores a new entry for a path given its file type.
func (*MetadataCache) PutSymlinkTarget ¶
func (cache *MetadataCache) PutSymlinkTarget(inode uint64, target string) error
PutSymlinkTarget stores a new symlink target for an existing inode.
type OneDirEntry ¶
OneDirEntry represents a single directory entry.
type RetriableRow ¶
type RetriableRow struct {
// contains filtered or unexported fields
}
RetriableRow wraps an sql.Row to be used as a helper for RetryQueryRow.
func (*RetriableRow) Scan ¶
func (row *RetriableRow) Scan(dest ...interface{}) error
Scan wraps sql.DB.Row.Scan to automatically retry on database contention.
type RetriableStmt ¶
RetriableStmt extends an sql.Stmt with functions to retry queries.
func (*RetriableStmt) RetryExec ¶
func (stmt *RetriableStmt) RetryExec(id string, args ...interface{}) ( sql.Result, error)
RetryExec wraps sql.DB.Exec to automatically retry on database contention.
func (*RetriableStmt) RetryQuery ¶
func (stmt *RetriableStmt) RetryQuery(id string, args ...interface{}) ( *sql.Rows, error)
RetryQuery wraps sql.DB.Query to automatically retry on database contention.
func (*RetriableStmt) RetryQueryRow ¶
func (stmt *RetriableStmt) RetryQueryRow(id string, args ...interface{}) *RetriableRow
RetryQueryRow wraps sql.DB.QueryRow to automatically retry on database contention.