Documentation ¶
Index ¶
Constants ¶
View Source
const (
// KeySuffix is the suffix appended to key names on disk.
KeySuffix = ".gob"
)
View Source
const ( // NoEntryForKey storage error msg NoEntryForKey string = "no entry for key" )
---------- Error Types ---------
Variables ¶
View Source
var KeyFormat = fmt.Sprintf("%%s%s", KeySuffix)
KeyFormat is used for creating the filename of the keys on disk
Functions ¶
func PruneByPrefix ¶
PruneByPrefix will remove objects over maxObjects from an S3 bucket with the given prefix
Types ¶
type Bucket ¶
type Bucket struct { // ACL Amazon S3 access control lists value ACL string // contains filtered or unexported fields }
Bucket wraps the S3 downloader with an in memory cache
func (*Bucket) List ¶
func (b *Bucket) List(prefix string, startAfter string) (*s3.ListObjectsV2Output, errors.TracerError)
List the contents of a bucket with the given prefix
func (*Bucket) ReadObject ¶
func (b *Bucket) ReadObject() ([]byte, errors.TracerError)
ReadObject downloads a file from s3 into a byte array
func (*Bucket) WriteObject ¶
func (b *Bucket) WriteObject(p []byte) errors.TracerError
WriteObject writes an object to a file in s3
type Provider ¶
type Provider interface { Shard(name string) (Provider, error) Read(key string, target interface{}) error Write(key string, target interface{}) error Exists(key string) bool Delete(key string) error }
Provider is a struct that implements the functions necessary to work with the persist package.
func NewDisk ¶
NewDisk storage provider using the passed root path and creating files with the specified mode.
func NewMemoryStorage ¶
func NewMemoryStorage() Provider
NewMemoryStorage for storing and retrieving key values.
Click to show internal directories.
Click to hide internal directories.