cell

package
v0.0.0-...-a7a8f6c Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option option funcation

func WithElasticell

func WithElasticell(value bool) Option

WithElasticell set is the storage is elasticell or redis The elasticell expanded some commands like 'lock', 'range load hash'

func WithRetry

func WithRetry(value int) Option

WithRetry set max retry times

type Storage

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

Storage storage using cell

func NewStorage

func NewStorage(cell *cedis.Cedis, opts ...Option) *Storage

NewStorage returns a transaction storage implementation by cell

func (*Storage) Count

func (s *Storage) Count(fragmentID uint64) (uint64, error)

Count returns the count of the active global transaction in storage

func (*Storage) Get

func (s *Storage) Get(fragmentID uint64, gid uint64) (*meta.GlobalTransaction, error)

Get returns the global transaction

func (*Storage) Load

func (s *Storage) Load(fragmentID uint64, query meta.Query, applyFunc func(*meta.GlobalTransaction) error) error

Load get the all global transcations from elasticell

func (*Storage) Lock

func (s *Storage) Lock(resource string, gid uint64, keys ...meta.LockKey) (bool, string, error)

Lock get the lock on the resource

func (*Storage) Lockable

func (s *Storage) Lockable(resource string, gid uint64, keys ...meta.LockKey) (bool, string, error)

Lockable returns the key is lockable on resource

func (*Storage) Manual

func (s *Storage) Manual(fragmentID uint64, applyFunc func(*meta.Manual) error) (int, error)

Manual handle manual action

func (*Storage) Put

func (s *Storage) Put(fragmentID uint64, transaction *meta.GlobalTransaction) error

Put puts the global transaction into elasitcell

func (*Storage) PutManual

func (s *Storage) PutManual(fragmentID uint64, manual *meta.Manual) error

PutManual put manual action into storage

func (*Storage) Remove

func (s *Storage) Remove(fragmentID uint64, transaction *meta.GlobalTransaction) error

Remove remove the global transaction from elasitcell

func (*Storage) Unlock

func (s *Storage) Unlock(resource string, keys ...meta.LockKey) error

Unlock release the lock on the resource

Jump to

Keyboard shortcuts

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