github.com/mweagle/Sparta@v1.15.0/aws/accessor/interface.go (about)

     1  package accessor
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  
     7  	"github.com/aws/aws-sdk-go/aws/client"
     8  	"github.com/aws/aws-xray-sdk-go/xray"
     9  )
    10  
    11  // Conditionally attach XRay if it seems like the right thing to do
    12  func xrayInit(awsClient *client.Client) {
    13  	if os.Getenv("AWS_XRAY_DAEMON_ADDRESS") != "" &&
    14  		os.Getenv("AWS_EXECUTION_ENV") != "" {
    15  		xray.AWS(awsClient)
    16  	}
    17  }
    18  
    19  // NewObjectConstructor returns a fresh instance
    20  // of the type that's stored in the KV store
    21  type NewObjectConstructor func() interface{}
    22  
    23  // KevValueAccessor represents a simple KV store
    24  type KevValueAccessor interface {
    25  	Delete(ctx context.Context, keyPath string) error
    26  	DeleteAll(ctx context.Context) error
    27  	Put(ctx context.Context, keyPath string, object interface{}) error
    28  	Get(ctx context.Context, keyPath string, object interface{}) error
    29  	GetAll(ctx context.Context, ctor NewObjectConstructor) ([]interface{}, error)
    30  }