Documentation ¶
Overview ¶
Package dydbassoc implements an assoc.Assoc based on AWS's DynamoDB.
Index ¶
- Constants
- type Assoc
- func (a *Assoc) BatchGet(ctx context.Context, batch assoc.Batch) error
- func (a *Assoc) CollectWithThreshold(ctx context.Context, live liveset.Liveset, dead liveset.Liveset, ...) error
- func (a *Assoc) Count(ctx context.Context) (int64, error)
- func (a *Assoc) Delete(ctx context.Context, k digest.Digest) error
- func (a *Assoc) Get(ctx context.Context, kind assoc.Kind, k digest.Digest) (digest.Digest, digest.Digest, error)
- func (a *Assoc) Help() string
- func (a *Assoc) Init(sess *session.Session, labels pool.Labels) error
- func (a *Assoc) Scan(ctx context.Context, kinds []assoc.Kind, mappingHandler assoc.MappingHandler) error
- func (a *Assoc) Setup(sess *session.Session, logger *log.Logger) error
- func (a *Assoc) Store(ctx context.Context, kind assoc.Kind, k, v digest.Digest) error
- func (a *Assoc) String() string
- func (a *Assoc) Version() int
- type Items
- type ItemsHandler
- type ItemsHandlerFunc
Constants ¶
const (
// ProviderName is the name of this Assoc's infra config provider.
ProviderName = "dynamodbassoc"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assoc ¶
type Assoc struct { infra2.TableNameFlagsTrait DB dynamodbiface.DynamoDBAPI `yaml:"-"` Limiter *limiter.Limiter `yaml:"-"` // Labels to assign to cache entries. Labels pool.Labels `yaml:"-"` // contains filtered or unexported fields }
Assoc implements a DynamoDB-backed Assoc for use in caches. Each association entry is represented by a DynamoDB item with the attributes "ID" and "Value".
func (*Assoc) BatchGet ¶
BatchGet implements the assoc interface. BatchGet will return a result for each key in the batch. BatchGet could internally split the keys into several batches. Any global errors, like context cancellation, S3 API errors or a key parse error would be returned from BatchGet. Any value parse errors would be returned as part of the result for that key.
func (*Assoc) CollectWithThreshold ¶
func (a *Assoc) CollectWithThreshold(ctx context.Context, live liveset.Liveset, dead liveset.Liveset, threshold time.Time, rate int64, dryRun bool) error
CollectWithThreshold removes from this Assoc any objects whose keys are not in the liveset and have not been accessed more recently than the liveset's threshold
func (*Assoc) Get ¶
func (a *Assoc) Get(ctx context.Context, kind assoc.Kind, k digest.Digest) (digest.Digest, digest.Digest, error)
Get returns the digest associated with key digest k. Lookup returns an error flagged errors.NotExist when no such mapping exists. Lookup also modifies the item's last-accessed time, which can be used for LRU object garbage collection. Get expands abbreviated keys by making use of a DynamoDB index.
func (*Assoc) Scan ¶
func (a *Assoc) Scan(ctx context.Context, kinds []assoc.Kind, mappingHandler assoc.MappingHandler) error
Scan calls the handler function for every association in the mapping. Note that the handler function may be called asynchronously from multiple threads.
type Items ¶
type Items []map[string]*dynamodb.AttributeValue
Items is the response from a dynamoDb scan.
type ItemsHandler ¶
type ItemsHandler interface { // HandleItems handles a set of scanned items. HandleItems(items Items) error }
ItemsHandler is an interface for handling Items from a segment scan.
type ItemsHandlerFunc ¶
ItemsHandlerFunc is a convenience type to avoid having to declare a struct to implement the ItemsHandler interface.
func (ItemsHandlerFunc) HandleItems ¶
func (h ItemsHandlerFunc) HandleItems(items Items) error
HandleItems implements the ItemsHandler interface.