Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( //ErrKeyNotString when partition key is not a valid string. ErrKeyNotString = errors.New("Key must be a string") //ErrInvalidObject occurs when object in cache is invalid. ErrInvalidObject = errors.New("Returned object is incorrect type") )
Functions ¶
func IsNotFound ¶
IsNotFound reflects on error and determines if its a real failure or not-found types
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is an instance of InfreqDB
func New ¶
New creates a new InfreqDB instance len is number of partitions to hold on disk.. use wisely... Better to use NewWithStorage() instead. New() will remain for backwards compatibility
func NewWithStorage ¶
NewWithStorage creates new DB with user provided storage
func (*DB) CheckExpiry ¶
CheckExpiry expires items that have changed upstream Maybe unexport it and launch as loop
func (*DB) Close ¶
func (db *DB) Close()
Close closes the db and deletes all local database fragments
func (*DB) SetPart ¶
SetPart uploads the partition to S3 and expires local cache fname is the path to an uncompressed boltdb file Cache for this partition is invalidated. If running on a cluster you need to propagate this and Expire(partid) somehow. Set mutable to true in case you expect changes to this partition
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage implements interface to access AWS S3. Uses gzip for compression
func NewS3Storage ¶
NewS3Storage creates new storage that talks to aws S3
func (*S3Storage) Get ¶
func (s3s *S3Storage) Get(part string) (fname string, found, mutable bool, lastmod time.Time, err error)
Get a partition file from S3 store into local file, suppress not found error
func (*S3Storage) GetLastMod ¶
GetLastMod gets last modification time for a partition Return ancient time on failure
type Storage ¶
type Storage interface { //Get retrieves a partition file from object store Get(part string) (fname string, found, mutable bool, lastmod time.Time, err error) //Put stores partition into object store Put(part, fname string, mutable bool) error //GetLastMod gets the last modified time for a partition. GetLastMod(part string) time.Time }
Storage allows various operations against an object store. Use any object/file store. The Storage is responsible for [un]compression. This might be a good place to hook in some sort of upstream cache layer.