Documentation ¶
Index ¶
- Variables
- type RedisOption
- func WithAssignedDeleteTimeout(assignedDeleteTimeout time.Duration) RedisOption
- func WithPendingReleaseTimeout(pendingReleaseTimeout time.Duration) RedisOption
- func WithRedisKeyPrefix(prefix string) RedisOption
- func WithRedisReadReplicaClient(client rueidis.Client) RedisOption
- func WithSeparatedAssignmentRedis(client rueidis.Client) RedisOption
- func WithTicketTTL(ticketTTL time.Duration) RedisOption
- type RedisOptionFunc
- type RedisStore
- func (s *RedisStore) AssignTickets(ctx context.Context, asgs []*pb.AssignmentGroup) error
- func (s *RedisStore) CreateTicket(ctx context.Context, ticket *pb.Ticket) error
- func (s *RedisStore) DeleteTicket(ctx context.Context, ticketID string) error
- func (s *RedisStore) GetActiveTicketIDs(ctx context.Context, limit int64) ([]string, error)
- func (s *RedisStore) GetAssignment(ctx context.Context, ticketID string) (*pb.Assignment, error)
- func (s *RedisStore) GetTicket(ctx context.Context, ticketID string) (*pb.Ticket, error)
- func (s *RedisStore) GetTicketCount(ctx context.Context) (int64, error)
- func (s *RedisStore) GetTickets(ctx context.Context, ticketIDs []string) ([]*pb.Ticket, error)
- func (s *RedisStore) ReleaseTickets(ctx context.Context, ticketIDs []string) error
- type StateStore
- type StoreWithTicketCache
- func (s *StoreWithTicketCache) AssignTickets(ctx context.Context, asgs []*pb.AssignmentGroup) error
- func (s *StoreWithTicketCache) CreateTicket(ctx context.Context, ticket *pb.Ticket) error
- func (s *StoreWithTicketCache) DeleteTicket(ctx context.Context, ticketID string) error
- func (s *StoreWithTicketCache) GetActiveTicketIDs(ctx context.Context, limit int64) ([]string, error)
- func (s *StoreWithTicketCache) GetAssignment(ctx context.Context, ticketID string) (*pb.Assignment, error)
- func (s *StoreWithTicketCache) GetTicket(ctx context.Context, ticketID string) (*pb.Ticket, error)
- func (s *StoreWithTicketCache) GetTicketCount(ctx context.Context) (int64, error)
- func (s *StoreWithTicketCache) GetTickets(ctx context.Context, ticketIDs []string) ([]*pb.Ticket, error)
- func (s *StoreWithTicketCache) ReleaseTickets(ctx context.Context, ticketIDs []string) error
- type TicketCacheOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTicketNotFound = errors.New("ticket not found") ErrAssignmentNotFound = errors.New("assignment not found") )
Functions ¶
This section is empty.
Types ¶
type RedisOption ¶
type RedisOption interface {
// contains filtered or unexported methods
}
func WithAssignedDeleteTimeout ¶
func WithAssignedDeleteTimeout(assignedDeleteTimeout time.Duration) RedisOption
func WithPendingReleaseTimeout ¶
func WithPendingReleaseTimeout(pendingReleaseTimeout time.Duration) RedisOption
func WithRedisKeyPrefix ¶ added in v0.2.3
func WithRedisKeyPrefix(prefix string) RedisOption
func WithRedisReadReplicaClient ¶ added in v0.3.1
func WithRedisReadReplicaClient(client rueidis.Client) RedisOption
func WithSeparatedAssignmentRedis ¶ added in v0.2.0
func WithSeparatedAssignmentRedis(client rueidis.Client) RedisOption
func WithTicketTTL ¶ added in v0.2.0
func WithTicketTTL(ticketTTL time.Duration) RedisOption
type RedisOptionFunc ¶
type RedisOptionFunc func(opts *redisOpts)
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(client rueidis.Client, locker rueidislock.Locker, opts ...RedisOption) *RedisStore
func (*RedisStore) AssignTickets ¶
func (s *RedisStore) AssignTickets(ctx context.Context, asgs []*pb.AssignmentGroup) error
func (*RedisStore) CreateTicket ¶
func (*RedisStore) DeleteTicket ¶
func (s *RedisStore) DeleteTicket(ctx context.Context, ticketID string) error
func (*RedisStore) GetActiveTicketIDs ¶ added in v0.2.3
GetActiveTicketIDs may also retrieve tickets deleted by TTL. This is because the ticket index and Ticket data are stored in separate keys. The next `GetTicket` or `GetTickets` call will resolve this inconsistency.
func (*RedisStore) GetAssignment ¶ added in v0.2.0
func (s *RedisStore) GetAssignment(ctx context.Context, ticketID string) (*pb.Assignment, error)
func (*RedisStore) GetTicketCount ¶ added in v0.3.2
func (s *RedisStore) GetTicketCount(ctx context.Context) (int64, error)
func (*RedisStore) GetTickets ¶ added in v0.2.3
func (*RedisStore) ReleaseTickets ¶
func (s *RedisStore) ReleaseTickets(ctx context.Context, ticketIDs []string) error
type StateStore ¶
type StateStore interface { CreateTicket(ctx context.Context, ticket *pb.Ticket) error DeleteTicket(ctx context.Context, ticketID string) error GetTicket(ctx context.Context, ticketID string) (*pb.Ticket, error) GetTickets(ctx context.Context, ticketIDs []string) ([]*pb.Ticket, error) GetAssignment(ctx context.Context, ticketID string) (*pb.Assignment, error) GetActiveTicketIDs(ctx context.Context, limit int64) ([]string, error) GetTicketCount(ctx context.Context) (int64, error) ReleaseTickets(ctx context.Context, ticketIDs []string) error AssignTickets(ctx context.Context, asgs []*pb.AssignmentGroup) error }
type StoreWithTicketCache ¶ added in v0.2.1
type StoreWithTicketCache struct {
// contains filtered or unexported fields
}
StoreWithTicketCache caches GetTicket results in-memory with TTL
func NewStoreWithTicketCache ¶ added in v0.2.1
func NewStoreWithTicketCache(origin StateStore, ticketCache *cache.Cache[string, *pb.Ticket], opts ...TicketCacheOption) *StoreWithTicketCache
func (*StoreWithTicketCache) AssignTickets ¶ added in v0.2.1
func (s *StoreWithTicketCache) AssignTickets(ctx context.Context, asgs []*pb.AssignmentGroup) error
func (*StoreWithTicketCache) CreateTicket ¶ added in v0.2.1
func (*StoreWithTicketCache) DeleteTicket ¶ added in v0.2.1
func (s *StoreWithTicketCache) DeleteTicket(ctx context.Context, ticketID string) error
func (*StoreWithTicketCache) GetActiveTicketIDs ¶ added in v0.2.3
func (*StoreWithTicketCache) GetAssignment ¶ added in v0.2.1
func (s *StoreWithTicketCache) GetAssignment(ctx context.Context, ticketID string) (*pb.Assignment, error)
func (*StoreWithTicketCache) GetTicketCount ¶ added in v0.3.2
func (s *StoreWithTicketCache) GetTicketCount(ctx context.Context) (int64, error)
func (*StoreWithTicketCache) GetTickets ¶ added in v0.2.3
func (*StoreWithTicketCache) ReleaseTickets ¶ added in v0.2.1
func (s *StoreWithTicketCache) ReleaseTickets(ctx context.Context, ticketIDs []string) error
type TicketCacheOption ¶ added in v0.2.1
type TicketCacheOption interface {
// contains filtered or unexported methods
}
func WithTicketCacheTTL ¶ added in v0.2.1
func WithTicketCacheTTL(ttl time.Duration) TicketCacheOption
Click to show internal directories.
Click to hide internal directories.