Documentation ¶
Index ¶
- Constants
- Variables
- type DynamoStore
- func (s *DynamoStore) CreateMutex(rqx *rqx.RequestContext, name, description string) error
- func (s *DynamoStore) CreateTable() error
- func (s *DynamoStore) GetMutex(name string, consistent bool) (*Mutex, error)
- func (s *DynamoStore) LockMutex(rqx *rqx.RequestContext, name, message string) error
- func (s *DynamoStore) UnlockMutex(rqx *rqx.RequestContext, name string) error
- type Mutex
- type MutexRepoFake
Constants ¶
const DefaultTableName = "stopgap"
DefaultTableName is used when a more specific name isn't provided.
Variables ¶
var ErrCreateTimedOut = errors.New("timed out waiting for table creation")
ErrCreateTimedOut is returned when table creation takes too long.
var ErrDeleteInProgress = errors.New("table deletion in progress")
ErrDeleteInProgress is returned when table creation fails because a table with the same name was recently deleted.
Functions ¶
This section is empty.
Types ¶
type DynamoStore ¶
type DynamoStore struct {
// contains filtered or unexported fields
}
DynamoStore stores mutex data in DynamoDB.
func New ¶
func New(svc *dynamodb.Client) *DynamoStore
New creates a DynamoStore instance using default values.
func NewWithTableName ¶
func NewWithTableName(svc *dynamodb.Client, table string) *DynamoStore
NewWithTableName create a DynamoStore instance, overriding the default table name.
func (*DynamoStore) CreateMutex ¶
func (s *DynamoStore) CreateMutex(rqx *rqx.RequestContext, name, description string) error
CreateMutex adds the named mutex.
func (*DynamoStore) CreateTable ¶
func (s *DynamoStore) CreateTable() error
CreateTable creates the DynamoStore table, if it doesn't already exist. This is only intended as a convenience function to make development and testing easier. It is not intended for use in production.
func (*DynamoStore) GetMutex ¶
func (s *DynamoStore) GetMutex(name string, consistent bool) (*Mutex, error)
GetMutex returns the data for a given mutex from the DynamoStore instance.
func (*DynamoStore) LockMutex ¶
func (s *DynamoStore) LockMutex(rqx *rqx.RequestContext, name, message string) error
LockMutex locks the named mutex.
func (*DynamoStore) UnlockMutex ¶
func (s *DynamoStore) UnlockMutex(rqx *rqx.RequestContext, name string) error
UnlockMutex unlocks the named mutex.
type MutexRepoFake ¶
MutexRepoFake should only be used in tests.
func NewMutexRepoFake ¶
func NewMutexRepoFake() *MutexRepoFake
NewMutexRepoFake creates a DynamoStore instance using default values.
func (*MutexRepoFake) CreateMutex ¶
func (r *MutexRepoFake) CreateMutex(rqx *rqx.RequestContext, name, description string) error
CreateMutex adds the named mutex.
func (*MutexRepoFake) LockMutex ¶
func (r *MutexRepoFake) LockMutex(rqx *rqx.RequestContext, name, message string) error
LockMutex locks the named mutex.
func (*MutexRepoFake) UnlockMutex ¶
func (r *MutexRepoFake) UnlockMutex(rqx *rqx.RequestContext, name string) error
UnlockMutex unlocks the named mutex.