Documentation ¶
Index ¶
- Constants
- func Password(p string) func(*redis.Options)
- type DB
- type Redis
- func (db *Redis) AddOne(table, key string, values string) error
- func (db *Redis) Close() error
- func (db *Redis) DeleteOne(table, key string) error
- func (db *Redis) DropTable(table string) error
- func (db *Redis) ExtendTTL(key string) error
- func (db *Redis) GetAllRecords(table string) (map[string]string, int, error)
- func (db *Redis) GetOne(table, key string) (string, error)
- func (db *Redis) Health() error
- func (db *Redis) Lock(key string) (bool, error)
- func (db *Redis) PipelineAddOne(table, key string, values string)
- func (db *Redis) PipelineExec() error
- func (db *Redis) Unlock(key string) (bool, error)
- type S3Bucket
- type S3Client
- func (c *S3Client) CreateS3Bucket(bucket *S3Bucket) (bool, error)
- func (c *S3Client) DeleteS3AllObjects(bucket *S3Bucket) error
- func (c *S3Client) DeleteS3Bucket(bucket *S3Bucket) (bool, error)
- func (c *S3Client) ExistsObject(key string) bool
- func (c *S3Client) GetObject(key string) (*io.ReadCloser, error)
- func (c *S3Client) UploadS3File(fileDir string, bucket *S3Bucket) error
Constants ¶
const ( // LockOn sets the lock LockOn = "locked" // LockOff unsets the lock LockOff = "unlocked" // TTL for the lock TTL = 30 * time.Second // TTLRefreshInterval intervals for refreshing the TTL of the lock TTLRefreshInterval = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB interface { GetOne(table string, key string) (string, error) AddOne(table string, key string, value string) error GetAllRecords(table string) (map[string]string, int, error) DeleteOne(table string, key string) error DropTable(table string) error PipelineAddOne(table, key string, values string) PipelineExec() error Close() error Health() error }
DB is the interface that will allow to use different backends for storing data into the database
type Redis ¶
type Redis struct { *redis.Client Pipeliner redis.Pipeliner }
Redis is a wrapper struct around Redis official package
func NewRedisClient ¶
NewRedisClient creates and open a new connection to Redis
func (*Redis) Close ¶
Close will be called as defer from the dependency whenever it's needed to close the connection
func (*Redis) GetAllRecords ¶
GetAllRecords returns all the records from that table the map[string]string represents the signalID -> recommendations encoded
func (*Redis) PipelineAddOne ¶
PipelineAddOne queues the HSET operation to the pipeline
func (*Redis) PipelineExec ¶
PipelineExec executes the commands in the Pipeline
type S3Client ¶
S3Client is the object that wraps around the official aws SDK
func NewS3Client ¶
NewS3Client is a wrapper object around the official aws s3 client
func (*S3Client) CreateS3Bucket ¶
CreateS3Bucket creates a bucket It returns false if the bucket exists, true otherwise
func (*S3Client) DeleteS3AllObjects ¶
DeleteS3AllObjects all objects within a bucket (this is not the most efficient way)
func (*S3Client) DeleteS3Bucket ¶
DeleteS3Bucket creates a bucket It returns false if the bucket exists, true otherwise
func (*S3Client) ExistsObject ¶
ExistsObject test if the specified key exists in the bucket It returns true if the key exists, false otherwise