Documentation

Overview

    Package dydbassoc implements an assoc.Assoc based on AWS's DynamoDB.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type Assoc

    type Assoc struct {
    	DB        dynamodbiface.DynamoDBAPI `yaml:"-"`
    	Limiter   *limiter.Limiter          `yaml:"-"`
    	TableName string                    `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".

      TODO(marius): support batch querying in this interface; it will be more efficient than relying on call concurrency.

      func (*Assoc) BatchGet

      func (a *Assoc) BatchGet(ctx context.Context, batch assoc.Batch) error

        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) Count

          func (a *Assoc) Count(ctx context.Context) (int64, error)

            Count returns an estimate of the number of associations in this mapping

            func (*Assoc) Delete

            func (a *Assoc) Delete(ctx context.Context, k digest.Digest) error

              Delete deletes the key k unconditionally from the provided assoc.

              func (*Assoc) Flags

              func (a *Assoc) Flags(flags *flag.FlagSet)

                Flags implements infra.Provider.

                func (*Assoc) Get

                  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) Help

                  func (a *Assoc) Help() string

                    Help implements infra.Provider.

                    func (*Assoc) Init

                    func (a *Assoc) Init(sess *session.Session, labels pool.Labels) error

                      Init implements infra.Provider.

                      func (*Assoc) Scan

                      func (a *Assoc) Scan(ctx context.Context, kind 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.

                        func (*Assoc) Setup

                        func (a *Assoc) Setup(sess *session.Session, logger *log.Logger) error

                          Setup implements infra.Provider.

                          func (*Assoc) Store

                          func (a *Assoc) Store(ctx context.Context, kind assoc.Kind, k, v digest.Digest) error

                            Store associates the digest v with the key digest k of the provided kind. If v is zero, k's association for (kind,v) will be removed.

                            func (*Assoc) String

                            func (a *Assoc) String() string

                            func (*Assoc) Version

                            func (a *Assoc) Version() int

                              Version implements infra.Provider.

                              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

                                  type ItemsHandlerFunc func(items Items) error

                                    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.