Documentation
¶
Index ¶
- func FromFile(f *os.File, db MetadataStore) (pathfs.FileSystem, error)
- func FromReaderAt(ra io.ReaderAt, size int64, db MetadataStore) (pathfs.FileSystem, error)
- func Newserver(db MetadataStore, tarStream io.ReaderAt) pathfs.FileSystem
- type DirIndex
- type FileInfo
- type MetadataStore
- type Owner
- type StatT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromFile ¶
func FromFile(f *os.File, db MetadataStore) (pathfs.FileSystem, error)
FromFile takes the passed in tar file and creates a new tarfs server Metadata from the tarfile is stored in the metadata store, which is used as the backing store for the tarfs server. The passed in file must not be acessed or modified while the server is active.
func FromReaderAt ¶
func FromReaderAt(ra io.ReaderAt, size int64, db MetadataStore) (pathfs.FileSystem, error)
FromReaderAt creates a new tarfs server from io.ReaderAt. The size of the tar archive needs to be provided. Metadata from the tarfile is stored in the metadata store, which is used as the backing store for the tarfs server.
func Newserver ¶
func Newserver(db MetadataStore, tarStream io.ReaderAt) pathfs.FileSystem
Newserver creates a new tarfs server from the passed in metadata store. The passed in metadata store should be pre-populated with filesystem metadata. See `FromFile` as an example of this.
Types ¶
type DirIndex ¶
type DirIndex interface {
Entries() []FileInfo
}
DirIndex is an interface which can be implemented by a FileInfo for the purpose of retreiving directory entries directly from the dir node.
type FileInfo ¶
type FileInfo interface { ModTime() time.Time AccessTime() time.Time ChangeTime() time.Time Inode() int64 Size() int64 Mode() os.FileMode Owner() Owner Name() string }
FileInfo is the metadata stored about a node in a tar file.
type MetadataStore ¶
type MetadataStore interface { Get(string) FileInfo Add(string, FileInfo) error Entries(string) []FileInfo }
MetadataStore is an abstraction for implementing different storages for filesystem metadata. This is used to insert or delete file metadata based on a key (typically the file path). It is also used to get the entries for a particular directory. TODO: Maybe `Entries()` isn't right here
func NewBTreeStore ¶
func NewBTreeStore(degree int) MetadataStore
NewBTreeStore creates a nw MetadatStore backed by an in-memory b-tree of the passed in degree.