redis

package
v0.0.0-...-9aada0e Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PIPELINES_KEY  = "pipelines"
	LEASE_DURATION = time.Minute
)

Variables

View Source
var (
	LeaseExpired  = errors.New("lease expired")
	LeaseNotFound = errors.New("lease not found")
	LeaseExists   = errors.New("lease already exists")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	GetPipelines(targets []interface{}) error
	GetPipeline(uid string, target interface{}) error
	SavePipeline(uid string, data interface{}) (*PipelineLease, error)
	CreatePipeline(uid, owner string, data interface{}) (*PipelineLease, error)

	AcquireLease(owner, pipelineUid string) (*PipelineLease, error)
	ExtendLease(owner, pipelineUid string) (*PipelineLease, error)
	TerminateLease(pipelineUid string) error

	SaveArtifact(pipelineUid, artifactName string, artifact []byte, retention time.Duration) error
	GetArtifact(pipelineUid, artifactName string) ([]byte, error)
	ListArtifacts(pipelineUid string) ([]string, error)
	GetArtifacts(pipelineUid string) (map[string][]byte, error)
}

func MustNewClient

func MustNewClient(isCluster bool, address string) Client

type PipelineLease

type PipelineLease struct {
	PipelineUid string    `json:"pipelineUid"`
	Owner       string    `json:"owner"`
	Acquired    time.Time `json:"acquired"`
	Expires     time.Time `json:"expires"`
}

type RedisClient

type RedisClient interface {
	TxPipeline() goredis.Pipeliner
	LRange(ctx context.Context, key string, start, stop int64) *goredis.StringSliceCmd
	Get(ctx context.Context, key string) *goredis.StringCmd
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *goredis.StatusCmd
	LPush(ctx context.Context, key string, values ...interface{}) *goredis.IntCmd
	Expire(ctx context.Context, key string, expiration time.Duration) *goredis.BoolCmd
	Del(ctx context.Context, keys ...string) *goredis.IntCmd
	HSet(ctx context.Context, key string, values ...interface{}) *goredis.IntCmd
	HGet(ctx context.Context, key, field string) *goredis.StringCmd
	HKeys(ctx context.Context, key string) *goredis.StringSliceCmd
}

type RedisError

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

func (*RedisError) Error

func (e *RedisError) Error() string

Jump to

Keyboard shortcuts

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