Documentation
¶
Index ¶
- Constants
- type CASObject
- type CASRefCount
- type CASStats
- type CASStore
- func (c *CASStore) AddReference(cid, filePath string) error
- func (c *CASStore) Delete(cid string) error
- func (c *CASStore) GarbageCollect() (int, error)
- func (c *CASStore) Get(cid string) ([]byte, error)
- func (c *CASStore) GetRefCount(cid string) (int, error)
- func (c *CASStore) GetStats() (CASStats, error)
- func (c *CASStore) Has(cid string) (bool, error)
- func (c *CASStore) Put(data []byte) (string, error)
- func (c *CASStore) RemoveReference(cid, filePath string) error
Constants ¶
const ( BucketCAS = "cas" BucketCASRefs = "cas_refs" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CASObject ¶
type CASObject struct {
CID string // Content identifier (multihash)
Data []byte // Object data
Size int // Size in bytes
}
CASObject represents a stored object in CAS
type CASRefCount ¶
type CASRefCount struct {
CID string `json:"cid"`
Refs int `json:"refs"`
Files []string `json:"files"` // Which files reference this CID
}
CASRefCount tracks references to a CAS object
type CASStats ¶
type CASStats struct {
TotalObjects int
TotalSize int64
TotalRefs int
UniqueFiles int
UnreferencedObjs int
}
Stats returns statistics about the CAS store
type CASStore ¶
type CASStore struct {
// contains filtered or unexported fields
}
CASStore implements content-addressable storage
func NewCASStore ¶
NewCASStore creates a new content-addressable storage instance
func (*CASStore) AddReference ¶
AddReference adds a reference from a file to a CID
func (*CASStore) Delete ¶
Delete removes a CID from CAS WARNING: This should only be called after verifying no references exist
func (*CASStore) GarbageCollect ¶
GarbageCollect removes unreferenced CAS objects
func (*CASStore) GetRefCount ¶
GetRefCount returns the reference count for a CID
func (*CASStore) Put ¶
Put stores data in CAS and returns its CID If the data already exists (same CID), it's deduplicated
func (*CASStore) RemoveReference ¶
RemoveReference removes a reference from a file to a CID