Documentation ¶
Index ¶
Constants ¶
const (
// GreyListTTL defined the TTL of a repository in seconds: 30 days (~30 days)
GreyListTTL = 60 * 60 * 24 * 30
)
const (
// RedisOK is the standard response of a Redis server if everything went fine ("OK")
RedisOK = "OK"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface { io.Closer // MarkRepositoryAsTweeted marks a single projects as "already tweeted". // This information will be stored in Redis as a simple set with a TTL. // The timestamp of the tweet will be used as value. MarkRepositoryAsTweeted(projectName, score string) (bool, error) // IsRepositoryAlreadyTweeted checks if a project was already tweeted. // If it is not available // a) the project was not tweeted yet // b) the project ttl expired and is ready to tweet again IsRepositoryAlreadyTweeted(projectName string) (bool, error) }
Connection represents a single connection out of a pool from a storage type.
type MemoryConnection ¶
type MemoryConnection struct {
// contains filtered or unexported fields
}
MemoryConnection represents a in memory connection
func (*MemoryConnection) Close ¶
func (mc *MemoryConnection) Close() error
Close shuts down a in memory connection
func (*MemoryConnection) IsRepositoryAlreadyTweeted ¶
func (mc *MemoryConnection) IsRepositoryAlreadyTweeted(projectName string) (bool, error)
IsRepositoryAlreadyTweeted checks if a project was already tweeted. If it is not available
a) the project was not tweeted yet b) the project ttl expired and is ready to tweet again
func (*MemoryConnection) MarkRepositoryAsTweeted ¶
func (mc *MemoryConnection) MarkRepositoryAsTweeted(projectName, score string) (bool, error)
MarkRepositoryAsTweeted marks a single projects as "already tweeted". This information will be stored as a hashmap with a TTL. The timestamp of the tweet will be used as value.
type MemoryPool ¶
type MemoryPool struct {
// contains filtered or unexported fields
}
MemoryPool is the pool of connections to your local memory ;)
func (MemoryPool) Get ¶
func (mp MemoryPool) Get() Connection
Get returns you a connection to your in memory storage
type MemoryStorage ¶
type MemoryStorage struct{}
MemoryStorage represents the in memory storage engine. This storage can be useful for debugging / development
func (*MemoryStorage) NewPool ¶
func (ms *MemoryStorage) NewPool(url, auth string) Pool
NewPool returns a pool to communicate with your in memory
type MemoryStorageContainer ¶
MemoryStorageContainer is the backend of the "in memory" storage engine. It supports a key (string) and a duration as time. The time duration can act as a TTL.
type Pool ¶
type Pool interface { io.Closer Get() Connection }
Pool is the implementation of a specific storage type. It should handle a pool of connections to communicate with the storage type.
type RedisConnection ¶
type RedisConnection struct {
// contains filtered or unexported fields
}
RedisConnection represents a single connection to a redis instance.
func (*RedisConnection) Close ¶
func (rc *RedisConnection) Close() error
Close will close a single redis connection
func (*RedisConnection) IsRepositoryAlreadyTweeted ¶
func (rc *RedisConnection) IsRepositoryAlreadyTweeted(projectName string) (bool, error)
IsRepositoryAlreadyTweeted checks if a project was already tweeted. If it is not available
a) the project was not tweeted yet b) the project ttl expired and is ready to tweet again
func (*RedisConnection) MarkRepositoryAsTweeted ¶
func (rc *RedisConnection) MarkRepositoryAsTweeted(projectName, score string) (bool, error)
MarkRepositoryAsTweeted marks a single projects as "already tweeted". This information will be stored in Redis as a simple set with a TTL. The timestamp of the tweet will be used as value.
type RedisPool ¶
type RedisPool struct {
// contains filtered or unexported fields
}
RedisPool is the connection pool to a redis instance
func (RedisPool) Get ¶
func (rp RedisPool) Get() Connection
Get will return a new connection out the pool
type RedisStorage ¶
type RedisStorage struct{}
RedisStorage represents the storage engine based on the Redis project / server
func (*RedisStorage) NewPool ¶
func (rs *RedisStorage) NewPool(url, auth string) Pool
NewPool returns a new redis connection pool