Documentation
¶
Index ¶
- Constants
- type Header
- type IndexRemapper
- type Iterator
- type MultihashPrimary
- func (mp *MultihashPrimary) Close() error
- func (cp *MultihashPrimary) FileSize() uint32
- func (cp *MultihashPrimary) Flush() (types.Work, error)
- func (mp *MultihashPrimary) GC(ctx context.Context, lowUsePercent int64) (int, error)
- func (cp *MultihashPrimary) Get(blk types.Block) ([]byte, []byte, error)
- func (cp *MultihashPrimary) GetIndexKey(blk types.Block) ([]byte, error)
- func (cp *MultihashPrimary) IndexKey(key []byte) ([]byte, error)
- func (cp *MultihashPrimary) Iter() (primary.PrimaryStorageIter, error)
- func (mp *MultihashPrimary) NewIndexRemapper() (*IndexRemapper, error)
- func (cp *MultihashPrimary) OutstandingWork() types.Work
- func (cp *MultihashPrimary) Put(key []byte, value []byte) (types.Block, error)
- func (mp *MultihashPrimary) StartGC(freeList *freelist.FreeList, interval, timeLimit time.Duration, ...)
- func (cp *MultihashPrimary) StorageSize() (int64, error)
- func (mp *MultihashPrimary) Sync() error
- type UpdateIndexFunc
Constants ¶
const ( // PrimaryVersion is stored in the header data to indicate how to interpret // primary data. PrimaryVersion = 1 SizePrefix = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Header ¶ added in v0.3.0
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 ¶ added in v0.3.0
type IndexRemapper struct {
// contains filtered or unexported fields
}
func (*IndexRemapper) FileSize ¶ added in v0.3.0
func (ir *IndexRemapper) FileSize() uint32
func (*IndexRemapper) RemapOffset ¶ added in v0.3.0
type Iterator ¶ added in v0.3.0
type Iterator struct {
// contains filtered or unexported fields
}
func NewIterator ¶ added in v0.3.0
type MultihashPrimary ¶
type MultihashPrimary struct {
// contains filtered or unexported fields
}
A primary storage that is multihash aware.
func Open ¶ added in v0.2.0
func Open(path string, freeList *freelist.FreeList, fileCache *filecache.FileCache, maxFileSize uint32) (*MultihashPrimary, error)
Open opens the multihash 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 (*MultihashPrimary) Close ¶
func (mp *MultihashPrimary) Close() error
Close calls Flush to write work and data to the primary file, and then closes the file.
func (*MultihashPrimary) FileSize ¶ added in v0.3.0
func (cp *MultihashPrimary) FileSize() uint32
func (*MultihashPrimary) Flush ¶
func (cp *MultihashPrimary) Flush() (types.Work, error)
Flush writes outstanding work and buffered data to the primary file.
func (*MultihashPrimary) GetIndexKey ¶
func (cp *MultihashPrimary) GetIndexKey(blk types.Block) ([]byte, error)
func (*MultihashPrimary) IndexKey ¶
func (cp *MultihashPrimary) IndexKey(key []byte) ([]byte, error)
func (*MultihashPrimary) Iter ¶
func (cp *MultihashPrimary) Iter() (primary.PrimaryStorageIter, error)
func (*MultihashPrimary) NewIndexRemapper ¶ added in v0.3.0
func (mp *MultihashPrimary) NewIndexRemapper() (*IndexRemapper, error)
func (*MultihashPrimary) OutstandingWork ¶
func (cp *MultihashPrimary) OutstandingWork() types.Work
func (*MultihashPrimary) 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 (*MultihashPrimary) StartGC ¶ added in v0.3.0
func (mp *MultihashPrimary) StartGC(freeList *freelist.FreeList, interval, timeLimit time.Duration, updateIndex UpdateIndexFunc)
func (*MultihashPrimary) StorageSize ¶ added in v0.2.0
func (cp *MultihashPrimary) StorageSize() (int64, error)
StorageSize returns bytes of storage used by the primary files.
func (*MultihashPrimary) Sync ¶
func (mp *MultihashPrimary) Sync() error
Sync commits the contents of the primary file to disk. Flush should be called before calling Sync.