Documentation
¶
Index ¶
- func CIDFromBytes(data []byte) (ret blobcache.CID)
- func CreateOnSameHost(ctx context.Context, s blobcache.Service, base blobcache.Handle, ...) (*blobcache.Handle, *blobcache.FQOID, error)
- func ExistsSingle(ctx context.Context, s interface{ ... }, txh Handle, cid CID) (bool, error)
- func GetBytes(ctx context.Context, src RO, cid blobcache.CID, hardMax int) ([]byte, error)
- func Modify(ctx context.Context, svc blobcache.Service, volh blobcache.Handle, ...) error
- func ModifyTx(ctx context.Context, svc blobcache.Service, volh blobcache.Handle, ...) error
- func OpenURL(ctx context.Context, bc blobcache.Service, u blobcache.URL) (*blobcache.Handle, error)
- func URLFor(ctx context.Context, bc blobcache.Service, volh blobcache.Handle) (*blobcache.URL, error)
- func View(ctx context.Context, svc blobcache.Service, volh blobcache.Handle, ...) error
- func View1[T any](ctx context.Context, svc blobcache.Service, volh blobcache.Handle, ...) (T, error)
- type ActionSet
- type CID
- type Cache
- type Handle
- type Loader
- type Marshaler
- type OID
- type Parser
- type RO
- type RW
- type RWD
- type Ref
- type Saver
- type Tx
- func (tx *Tx) Abort(ctx context.Context) error
- func (tx *Tx) Commit(ctx context.Context) error
- func (tx *Tx) Copy(ctx context.Context, srcs []*Tx, cids []CID, success []bool) error
- func (tx *Tx) Delete(ctx context.Context, cids []CID) error
- func (tx *Tx) Exists(ctx context.Context, cids []CID, exists []bool) error
- func (tx *Tx) Get(ctx context.Context, cid CID, buf []byte) (int, error)
- func (tx *Tx) GetBytes(ctx context.Context, cid CID, hardMax int) ([]byte, error)
- func (tx *Tx) Hash(data []byte) CID
- func (tx *Tx) HashAlgo() blobcache.HashAlgo
- func (tx *Tx) Inspect(ctx context.Context) (*blobcache.TxInfo, error)
- func (tx *Tx) IsVisited(ctx context.Context, cids []CID, yesVisited []bool) error
- func (tx *Tx) KeepAlive(ctx context.Context) error
- func (tx *Tx) Link(ctx context.Context, target blobcache.Handle, mask ActionSet) (*blobcache.LinkToken, error)
- func (tx *Tx) Load(ctx context.Context, dst *[]byte) error
- func (tx *Tx) MaxSize() int
- func (tx *Tx) Post(ctx context.Context, data []byte) (CID, error)
- func (tx *Tx) Save(ctx context.Context, src []byte) error
- func (tx *Tx) Unlink(ctx context.Context, targets []blobcache.LinkToken) error
- func (tx *Tx) Visit(ctx context.Context, cids []CID) error
- func (tx *Tx) VisitLinks(ctx context.Context, targets []blobcache.LinkToken) error
- type TxSalt
- func (tx *TxSalt) Abort(ctx context.Context) error
- func (tx *TxSalt) Commit(ctx context.Context) error
- func (tx *TxSalt) Delete(ctx context.Context, cid CID) error
- func (tx *TxSalt) Exists(ctx context.Context, cid CID) (bool, error)
- func (tx *TxSalt) Get(ctx context.Context, cid CID, buf []byte, opts blobcache.GetOpts) (int, error)
- func (tx *TxSalt) Hash(salt *CID, data []byte) CID
- func (tx *TxSalt) HashAlgo() blobcache.HashAlgo
- func (tx *TxSalt) Inspect(ctx context.Context) (*blobcache.TxInfo, error)
- func (tx *TxSalt) KeepAlive(ctx context.Context) error
- func (tx *TxSalt) Load(ctx context.Context, dst *[]byte) error
- func (tx *TxSalt) MaxSize() int
- func (tx *TxSalt) Post(ctx context.Context, data []byte, opts blobcache.PostOpts) (CID, error)
- func (tx *TxSalt) Save(ctx context.Context, src []byte) error
- type WO
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CIDFromBytes ¶ added in v0.4.0
func CreateOnSameHost ¶
func CreateOnSameHost(ctx context.Context, s blobcache.Service, base blobcache.Handle, spec blobcache.VolumeSpec) (*blobcache.Handle, *blobcache.FQOID, error)
CreateOnSameHost creates a new subvolume on the same host as the base volume.
func ExistsSingle ¶
func ExistsSingle(ctx context.Context, s interface { Exists(ctx context.Context, txh Handle, cids []CID, dst []bool) error }, txh Handle, cid CID) (bool, error)
ExistsSingle is a convenience function for checking if a single CID exists using the slice based API.
func GetBytes ¶ added in v0.4.0
GetBytes gets a blob, but gracefully handles ErrTooSmall by resizing the buffer and retrying.
func Modify ¶ added in v0.0.2
func Modify(ctx context.Context, svc blobcache.Service, volh blobcache.Handle, fn func(s RW, root []byte) ([]byte, error)) error
Modify performs a modifying transaction on the volume.
func URLFor ¶ added in v0.0.2
func URLFor(ctx context.Context, bc blobcache.Service, volh blobcache.Handle) (*blobcache.URL, error)
URLFor produces a URL for a Volume. If the Volume is a remote Volume than the OID of the Volume on the remote Node and the Endpoint of the remote Node will be included in the URL instead of the local Node.
Types ¶
type Cache ¶ added in v0.4.0
type Cache[T any] struct { // contains filtered or unexported fields }
type Marshaler ¶ added in v0.4.0
Marshaler marshals a value of type T and appends it to out, returning the result
type RO ¶ added in v0.0.2
type RO interface {
Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)
Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error
Hash(data []byte) blobcache.CID
MaxSize() int
}
RO is read-only Store methods
type Ref ¶ added in v0.4.0
type Ref[T any] struct { // contains filtered or unexported fields }
Ref is a typed blobcache.CID
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a convenience type for managing a transaction within a Service.
func BeginTx ¶
func BeginTx(ctx context.Context, s blobcache.Service, volH blobcache.Handle, txp blobcache.TxParams) (*Tx, error)
BeginTx begins a new transaction and returns the Tx type.
type TxSalt ¶
type TxSalt struct {
// contains filtered or unexported fields
}
TxSalt is a convenience type for managing a salted transaction within a Service.
func BeginTxSalt ¶
func BeginTxSalt(ctx context.Context, s blobcache.Service, volH Handle, txp blobcache.TxParams) (*TxSalt, error)
BeginTxSalt is the salted variant of BeginTx.
type Watcher ¶ added in v0.4.0
type Watcher struct {
// contains filtered or unexported fields
}
Watcher watches a Volume for changes using a queue subscription. Changes are delivered as read-only transactions on the Out channel.
func NewWatcher ¶ added in v0.4.0
NewWatcher creates a new Watcher that subscribes to volume changes. It creates a queue, subscribes it to the volume, and spawns a goroutine that sends a read-only Tx on the Out channel whenever the volume changes.
func (*Watcher) Close ¶ added in v0.4.0
Close stops the goroutine and closes the Out channel. It causes ForEach to return nil.