Documentation ¶
Index ¶
- Constants
- func DecodeFlushRecord(payload []byte) (*backend.FlushRecord, error)
- func DisableLog()
- func EncodeFlushRecord(fr backend.FlushRecord) ([]byte, error)
- func UseLogger(logger slog.Logger)
- type FileSystem
- func (fs *FileSystem) Close()
- func (fs *FileSystem) Dump(f *os.File, verbose bool) error
- func (fs *FileSystem) Fsck(options *backend.FsckOptions) error
- func (fs *FileSystem) Get(digests [][sha256.Size]byte) ([]backend.GetResult, error)
- func (fs *FileSystem) GetTimestamps(timestamps []int64) ([]backend.TimestampResult, error)
- func (fs *FileSystem) Put(hashes [][sha256.Size]byte) (int64, []backend.PutResult, error)
- func (fs *FileSystem) Restore(f *os.File, verbose bool, location string) error
- type FilesystemAction
- type FilesystemDeleteDigest
- type FilesystemDeleteDuplicate
- type FilesystemDeleteTimestamp
- type FilesystemHeader
Constants ¶
const ( FilesystemActionVersion = 1 // All structure versions FilesystemActionHeader = "header" FilesystemActionDeleteTimestamp = "deletetimestamp" FilesystemActionDeleteDigest = "deletedigest" FilesystemActionDeleteDuplicate = "deleteduplicate" )
Variables ¶
This section is empty.
Functions ¶
func DecodeFlushRecord ¶
func DecodeFlushRecord(payload []byte) (*backend.FlushRecord, error)
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
func EncodeFlushRecord ¶
func EncodeFlushRecord(fr backend.FlushRecord) ([]byte, error)
Types ¶
type FileSystem ¶
FileSystem is a naive implementation of a backend. It uses rounded timestamps as an index directory which then contains a leveldb with the content. There is also a global leveldb that provides a reverse index.
func New ¶
func New(root, cert, host string, enableCollections bool, passphrase []byte) (*FileSystem, error)
New creates a new backend instance. The caller should issue a Close once the FileSystem backend is no longer needed.
func NewDump ¶
func NewDump(root string) (*FileSystem, error)
func NewRestore ¶
func NewRestore(root string) (*FileSystem, error)
func (*FileSystem) Close ¶
func (fs *FileSystem) Close()
Close is a required interface function. In our case we close the global database.
Close satisfies the backend interface.
func (*FileSystem) Dump ¶
func (fs *FileSystem) Dump(f *os.File, verbose bool) error
Dump walks all directories and dumps the content to either verbose readable or JSON format.
func (*FileSystem) Fsck ¶
func (fs *FileSystem) Fsck(options *backend.FsckOptions) error
Fsck walks all directories and verifies all that there is no apparent data corruption and that the flush records indeed exist on the blockchain.
func (*FileSystem) Get ¶
Get returns a GetResult for each provided digest.
Get satisfies the backend interface.
func (*FileSystem) GetTimestamps ¶
func (fs *FileSystem) GetTimestamps(timestamps []int64) ([]backend.TimestampResult, error)
GetTimestamps is a required interface function. In our case it retrieves the digests for a given timestamp.
GetTimestamps satisfies the backend interface.
type FilesystemAction ¶
type FilesystemDeleteDigest ¶
type FilesystemDeleteDuplicate ¶
type FilesystemDeleteDuplicate struct { Version uint64 `json:"version"` // Version of structure Digest string `json:"digest"` // Duplicate digest Found int64 `json:"found"` // Original timestamp FoundDirectory string `json:"founddirectory"` // Original directory Duplicate int64 `json:"duplicate"` // Duplicate timestamp DuplicateDirectory string `json:"duplicatedirectory"` // Duplicate directory }