Documentation
¶
Index ¶
- func NewFileTracker(delete deleteCallback) *fileTracker
- type FS
- type File
- type ROFile
- type StoredFile
- type TierFS
- func (tfs *TierFS) Create(_ context.Context, namespace string) (StoredFile, error)
- func (tfs *TierFS) Exists(ctx context.Context, namespace, filename string) (bool, error)
- func (tfs *TierFS) GetRemoteURI(_ context.Context, _, filename string) (string, error)
- func (tfs *TierFS) Open(ctx context.Context, namespace, filename string) (File, error)
- type WRFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFileTracker ¶ added in v0.82.0
func NewFileTracker(delete deleteCallback) *fileTracker
Types ¶
type FS ¶
type FS interface {
// Create creates a new file in the FS.
// It will only be persistent after the returned file is stored.
Create(ctx context.Context, namespace string) (StoredFile, error)
// Open finds the referenced file and returns its read-only File.
// If file isn't in the local disk, it is fetched from the block storage.
Open(ctx context.Context, namespace, filename string) (File, error)
// Exists returns true if filename currently exists on block storage.
Exists(ctx context.Context, namespace, filename string) (bool, error)
// GetRemoteURI returns the URI for filename on block storage. That URI might not
// resolve if filename does not exist.
GetRemoteURI(ctx context.Context, namespace, filename string) (string, error)
}
FS is pyramid abstraction of filesystem where the persistent storage-layer is the block storage. Files on the local disk are transient and might be cleaned up by the eviction policy. File structure under a namespace and namespace itself are flat (no directories).
type File ¶
type File interface {
io.Reader
io.Writer
io.Closer
io.ReaderAt
Sync() error
Stat() (os.FileInfo, error)
}
File is pyramid abstraction for an os.File
type ROFile ¶
ROFile is pyramid wrapper for os.File that implements io.ReadCloser with hooks for updating evictions.
type StoredFile ¶
type StoredFile interface {
File
// Store - Successful operation guarantees that the file is persistent.
// If the file wasn't closed, Store closes it.
Store(ctx context.Context, filename string) error
// Abort removes all traces of the file from the filesystem.
// It's allowed to call Abort on the file at any stage, unless the file was already stored.
Abort(ctx context.Context) error
}
StoredFile is pyramid abstraction for an os.File with a Store operation that makes the file persistent
type TierFS ¶
type TierFS struct {
// contains filtered or unexported fields
}
TierFS is a filesystem where written files are never edited. All files are stored in the block storage. Local paths are treated as a cache layer that will be evicted according to the eviction control.
func (*TierFS) Create ¶
Create creates a new file in TierFS. File isn't stored in TierFS until a successful close operation. Open(namespace, filename) calls will return an error before the close was called. Create only performs local operations so it ignores the context.