statestore

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRedisPool added in v1.0.0

func GetRedisPool(cfg config.View) *redis.Pool

GetRedisPool configures a new pool to connect to redis given the config.

Types

type Service

type Service interface {
	// HealthCheck indicates if the database is reachable.
	HealthCheck(ctx context.Context) error

	// CreateTicket creates a new Ticket in the state storage. If the id already exists, it will be overwritten.
	CreateTicket(ctx context.Context, ticket *pb.Ticket) error

	// GetTicket gets the Ticket with the specified id from state storage. This method fails if the Ticket does not exist.
	GetTicket(ctx context.Context, id string) (*pb.Ticket, error)

	// DeleteTicket removes the Ticket with the specified id from state storage. This method succeeds if the Ticket does not exist.
	DeleteTicket(ctx context.Context, id string) error

	// IndexTicket adds the ticket to the index.
	IndexTicket(ctx context.Context, ticket *pb.Ticket) error

	// DeindexTicket removes specified ticket from the index. The Ticket continues to exist.
	DeindexTicket(ctx context.Context, id string) error

	// GetIndexedIDSet returns the ids of all tickets currently indexed.
	GetIndexedIDSet(ctx context.Context) (map[string]struct{}, error)

	// GetTickets returns multiple tickets from storage.  Missing tickets are
	// silently ignored.
	GetTickets(ctx context.Context, ids []string) ([]*pb.Ticket, error)

	// UpdateAssignments update using the request's specified tickets with assignments.
	UpdateAssignments(ctx context.Context, req *pb.AssignTicketsRequest) (*pb.AssignTicketsResponse, error)

	// GetAssignments returns the assignment associated with the input ticket id
	GetAssignments(ctx context.Context, id string, callback func(*pb.Assignment) error) error

	// AddProposedTickets appends new proposed tickets to the proposed sorted set with current timestamp
	AddTicketsToIgnoreList(ctx context.Context, ids []string) error

	// DeleteTicketsFromIgnoreList deletes tickets from the proposed sorted set
	DeleteTicketsFromIgnoreList(ctx context.Context, ids []string) error

	// ReleaseAllTickets releases all pending tickets back to active
	ReleaseAllTickets(ctx context.Context) error

	// Closes the connection to the underlying storage.
	Close() error
}

Service is a generic interface for talking to a storage backend.

func New

func New(cfg config.View) Service

New creates a Service based on the configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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