Documentation ¶
Index ¶
- Variables
- type Index
- func (idx *Index) Encode(w io.Writer) error
- func (idx *Index) Final() bool
- func (idx *Index) Finalize()
- func (idx *Index) Has(bh rest.BlobHandle) bool
- func (idx *Index) IDs() (rest.IDs, error)
- func (idx *Index) Lookup(bh rest.BlobHandle, pbs []rest.PackedBlob) []rest.PackedBlob
- func (idx *Index) LookupSize(bh rest.BlobHandle) (plaintextLength uint, found bool)
- func (idx *Index) SaveIndex(ctx context.Context, repo rest.SaverUnpacked) (rest.ID, error)
- func (idx *Index) SetID(id rest.ID) error
- func (idx *Index) StorePack(id rest.ID, blobs []rest.Blob)
- type MasterIndex
- func (mi *MasterIndex) AddPending(bh rest.BlobHandle) bool
- func (mi *MasterIndex) Lookup(bh rest.BlobHandle) (pbs []rest.PackedBlob)
- func (mi *MasterIndex) LookupSize(bh rest.BlobHandle) (uint, bool)
- func (mi *MasterIndex) MergeFinalIndexes() error
- func (mi *MasterIndex) SaveFullIndex(ctx context.Context, r rest.SaverUnpacked) error
- func (mi *MasterIndex) SaveIndex(ctx context.Context, r rest.SaverUnpacked) error
- func (mi *MasterIndex) StorePack(id rest.ID, blobs []rest.Blob)
Constants ¶
This section is empty.
Variables ¶
var IndexFull = func(idx *Index) bool { idx.m.RLock() defer idx.m.RUnlock() log.Debugf("checking whether index %p is full", idx) var blobs uint for typ := range idx.byType { blobs += idx.byType[typ].len() } age := time.Since(idx.created) switch { case age >= indexMaxAge: log.Debugf("index %p is old enough", idx, age) return true case blobs >= indexMaxBlobs: log.Debugf("index %p has %d blobs", idx, blobs) return true } log.Debugf("index %p only has %d blobs and is too young (%v)", idx, blobs, age) return false }
IndexFull returns true iff the index is "full enough" to be saved as a preliminary index.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) Final ¶
Final returns true iff the index is already written to the repository, it is finalized.
func (*Index) Has ¶
func (idx *Index) Has(bh rest.BlobHandle) bool
Has returns true iff the id is listed in the index.
func (*Index) IDs ¶
IDs returns the IDs of the index, if available. If the index is not yet finalized, an error is returned.
func (*Index) Lookup ¶
func (idx *Index) Lookup(bh rest.BlobHandle, pbs []rest.PackedBlob) []rest.PackedBlob
Lookup queries the index for the blob ID and returns all entries including duplicates. Adds found entries to blobs and returns the result.
func (*Index) LookupSize ¶
func (idx *Index) LookupSize(bh rest.BlobHandle) (plaintextLength uint, found bool)
LookupSize returns the length of the plaintext content of the blob with the given id.
type MasterIndex ¶
type MasterIndex struct {
// contains filtered or unexported fields
}
func NewMasterIndex ¶
func NewMasterIndex() *MasterIndex
func (*MasterIndex) AddPending ¶
func (mi *MasterIndex) AddPending(bh rest.BlobHandle) bool
AddPending adds a given blob to list of pending Blobs Before doing so it checks if this blob is already known. Returns true if adding was successful and false if the blob was already known
func (*MasterIndex) Lookup ¶
func (mi *MasterIndex) Lookup(bh rest.BlobHandle) (pbs []rest.PackedBlob)
Lookup queries all known Indexes for the ID and returns all matches.
func (*MasterIndex) LookupSize ¶
func (mi *MasterIndex) LookupSize(bh rest.BlobHandle) (uint, bool)
LookupSize queries all known Indexes for the ID and returns the first match.
func (*MasterIndex) MergeFinalIndexes ¶
func (mi *MasterIndex) MergeFinalIndexes() error
MergeFinalIndexes merges all final indexes together. After calling, there will be only one big final index in MasterIndex containing all final index contents. Indexes that are not final are left untouched. This merging can only be called after all index files are loaded - as removing of superseded index contents is only possible for unmerged indexes.
func (*MasterIndex) SaveFullIndex ¶
func (mi *MasterIndex) SaveFullIndex(ctx context.Context, r rest.SaverUnpacked) error
SaveFullIndex saves all full indexes in the backend.
func (*MasterIndex) SaveIndex ¶
func (mi *MasterIndex) SaveIndex(ctx context.Context, r rest.SaverUnpacked) error
SaveIndex saves all new indexes in the backend.