Documentation ¶
Index ¶
- Constants
- type GsfaPrimary
- func (mp *GsfaPrimary) Close() error
- func (cp *GsfaPrimary) FileSize() uint32
- func (cp *GsfaPrimary) Flush() (types.Work, error)
- func (cp *GsfaPrimary) Get(blk types.Block) ([]byte, []byte, error)
- func (cp *GsfaPrimary) GetIndexKey(blk types.Block) ([]byte, error)
- func (cp *GsfaPrimary) IndexKey(key []byte) ([]byte, error)
- func (cp *GsfaPrimary) Iter() (primary.PrimaryStorageIter, error)
- func (mp *GsfaPrimary) NewIndexRemapper() (*IndexRemapper, error)
- func (cp *GsfaPrimary) OutstandingWork() types.Work
- func (cp *GsfaPrimary) Overwrite(blk types.Block, key []byte, value []byte) error
- func (cp *GsfaPrimary) Put(key []byte, value []byte) (types.Block, error)
- func (cp *GsfaPrimary) StorageSize() (int64, error)
- func (mp *GsfaPrimary) Sync() error
- type Header
- type IndexRemapper
- type Iterator
- type Pubkey
Constants ¶
const ( // PrimaryVersion is stored in the header data to indicate how to interpret // primary data. PrimaryVersion = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GsfaPrimary ¶
type GsfaPrimary struct {
// contains filtered or unexported fields
}
A primary storage that is multihash aware.
func Open ¶
func Open(path string, freeList *freelist.FreeList, fileCache *filecache.FileCache, maxFileSize uint32) (*GsfaPrimary, error)
Open opens the gsfa primary storage file. The primary is created if there is no existing primary at the specified path. If there is an older version primary, then it is automatically upgraded.
func (*GsfaPrimary) Close ¶
func (mp *GsfaPrimary) Close() error
Close calls Flush to write work and data to the primary file, and then closes the file.
func (*GsfaPrimary) FileSize ¶
func (cp *GsfaPrimary) FileSize() uint32
func (*GsfaPrimary) Flush ¶
func (cp *GsfaPrimary) Flush() (types.Work, error)
Flush writes outstanding work and buffered data to the primary file.
func (*GsfaPrimary) GetIndexKey ¶
func (cp *GsfaPrimary) GetIndexKey(blk types.Block) ([]byte, error)
func (*GsfaPrimary) Iter ¶
func (cp *GsfaPrimary) Iter() (primary.PrimaryStorageIter, error)
func (*GsfaPrimary) NewIndexRemapper ¶
func (mp *GsfaPrimary) NewIndexRemapper() (*IndexRemapper, error)
func (*GsfaPrimary) OutstandingWork ¶
func (cp *GsfaPrimary) OutstandingWork() types.Work
func (*GsfaPrimary) Put ¶
Put adds a new pending blockRecord to the pool and returns a Block that contains the location that the block will occupy in the primary. The returned primary location must be an absolute position across all primary files.
func (*GsfaPrimary) StorageSize ¶
func (cp *GsfaPrimary) StorageSize() (int64, error)
StorageSize returns bytes of storage used by the primary files.
func (*GsfaPrimary) Sync ¶
func (mp *GsfaPrimary) Sync() error
Sync commits the contents of the primary file to disk. Flush should be called before calling Sync.
type Header ¶
type Header struct { // A version number in case we change the header Version int // MaxFileSize is the size limit of each index file. This cannot be greater // than 4GiB. MaxFileSize uint32 // First index file number FirstFile uint32 }
Header contains information about the primary. This is actually stored in a separate ".info" file, but is the first file read when the index is opened.
type IndexRemapper ¶
type IndexRemapper struct {
// contains filtered or unexported fields
}
func (*IndexRemapper) FileSize ¶
func (ir *IndexRemapper) FileSize() uint32
func (*IndexRemapper) RemapOffset ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}