Documentation ¶
Index ¶
- Variables
- func HashAll(r io.Reader, algorithm crypto.Hash, blockSize int) (all []byte, blocks [][]byte, n int64, err error)
- type Blob
- type EqualBlobs
- type Hasher
- type Index
- type IndexConfig
- type Indexer
- type LockedIndex
- func (i *LockedIndex) AllNames() (Names, error)
- func (i *LockedIndex) Count() (int, error)
- func (i *LockedIndex) FindEqualHashes() ([]EqualBlobs, error)
- func (i *LockedIndex) LookupByName(name string) (*Blob, error)
- func (i *LockedIndex) Remove(names Names) error
- func (i *LockedIndex) Store(blob *Blob) error
- type Names
- type OptimisticLockingError
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Blob ¶
type Blob struct { Name string Version uint64 IndexTime time.Time Size int64 ModTime time.Time HashAlgorithm crypto.Hash // hash of the full blob Hash []byte // size of hashed blocks HashBlockSize int // hashes of individual blocks HashedBlocks [][]byte }
func (*Blob) CheckOptimisticLock ¶
type EqualBlobs ¶
func (*EqualBlobs) Append ¶
func (e *EqualBlobs) Append(blob *Blob)
func (*EqualBlobs) AppendRaw ¶
func (e *EqualBlobs) AppendRaw(name string, size int64)
func (*EqualBlobs) ContainsAnyName ¶
func (e *EqualBlobs) ContainsAnyName(names map[string]struct{}) bool
type Hasher ¶
type Index ¶
type Index interface { // stores a blob by its name. // if the version field is zero and no such blob exists it will be stored. // existing blobs will be overwritten if the new version is excalty one higher than the existing one. // otherwise a OptimisticLockingError will be returned. Store(blob *Blob) error // blob lookup by name. if no blob by a certain name exists "nil, nil" is returned. // the error return value is indicative of problems with the underlying storage strategy. LookupByName(name string) (*Blob, error) FindEqualHashes() ([]EqualBlobs, error) AllNames() (Names, error) Remove(names Names) error Count() (int, error) }
func NewMemoryIndex ¶
func NewMemoryIndex() Index
type IndexConfig ¶
type Indexer ¶
type LockedIndex ¶
type LockedIndex struct { Backend Index // contains filtered or unexported fields }
func (*LockedIndex) AllNames ¶
func (i *LockedIndex) AllNames() (Names, error)
func (*LockedIndex) Count ¶
func (i *LockedIndex) Count() (int, error)
func (*LockedIndex) FindEqualHashes ¶
func (i *LockedIndex) FindEqualHashes() ([]EqualBlobs, error)
func (*LockedIndex) LookupByName ¶
func (i *LockedIndex) LookupByName(name string) (*Blob, error)
func (*LockedIndex) Remove ¶
func (i *LockedIndex) Remove(names Names) error
func (*LockedIndex) Store ¶
func (i *LockedIndex) Store(blob *Blob) error
type OptimisticLockingError ¶
func (*OptimisticLockingError) Error ¶
func (o *OptimisticLockingError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.