storage

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2016 License: MIT Imports: 2 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// GreyListTTL defined the TTL of a repository in seconds: 30 days (~30 days)
	GreyListTTL = 60 * 60 * 24 * 30
)
View Source
const (
	// OK is the standard response of a Redis server if everything went fine
	RedisOK = "OK"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	// Close closes the connection.
	Close() 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.
	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)
}

type MemoryConnection

type MemoryConnection struct {
	// contains filtered or unexported fields
}

func (*MemoryConnection) Close

func (mc *MemoryConnection) Close() error

func (*MemoryConnection) IsRepositoryAlreadyTweeted

func (mc *MemoryConnection) IsRepositoryAlreadyTweeted(projectName string) (bool, error)

func (*MemoryConnection) MarkRepositoryAsTweeted

func (mc *MemoryConnection) MarkRepositoryAsTweeted(projectName, score string) (bool, error)

type MemoryPool

type MemoryPool struct {
	// contains filtered or unexported fields
}

func (MemoryPool) Close

func (mp MemoryPool) Close() error

func (MemoryPool) Get

func (mp MemoryPool) Get() Connection

type MemoryStorage

type MemoryStorage struct{}

func (*MemoryStorage) NewPool

func (ms *MemoryStorage) NewPool(url, auth string) Pool

type MemoryStorageContainer

type MemoryStorageContainer map[string]time.Time

type Pool

type Pool interface {
	Close() error
	Get() Connection
}

func GetBackend added in v0.3.0

func GetBackend(storageURL string, storageAuth string, debug bool) Pool

type RedisConnection

type RedisConnection struct {
	// contains filtered or unexported fields
}

func (*RedisConnection) Close

func (rc *RedisConnection) Close() error

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
}

func (RedisPool) Close

func (rp RedisPool) Close() error

func (RedisPool) Get

func (rp RedisPool) Get() Connection

type RedisStorage

type RedisStorage struct{}

func (*RedisStorage) NewPool

func (rs *RedisStorage) NewPool(url, auth string) Pool

type Storage

type Storage interface {
	NewPool(url, auth string) Pool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL