storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2015 License: MIT Imports: 2 Imported by: 6 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// GreyListTTL defined the TTL of a repository in seconds: 1 month and 15 days (~45 days)
	GreyListTTL = 60 * 60 * 24 * 45
)
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
}

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