Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TransactConflicting ¶
func TransactConflicting( database fdb.Database, f func(fdb.Transaction) (interface{}, error), onCommit func(fdb.Transaction)) (interface{}, error)
TransactConflicting is the same as db.Transact, but won't retry in case of conflicting transactions and will throw NewTokenInvalidError instead it will also execute onCommit callback if transaction commits sucessfully
Types ¶
type AtomicMax ¶
type AtomicMax struct {
// contains filtered or unexported fields
}
AtomicMax is used to track the max value.
type ReadVersionCache ¶
type ReadVersionCache struct {
// contains filtered or unexported fields
}
ReadVersionCache caches "safe" read versions, which are known to be
func Init ¶
func Init(database fdb.Database, currentToken uint64, tokenKey fdb.KeyConvertible, updateInterval time.Duration) *ReadVersionCache
Init initializes the read version cache
func (*ReadVersionCache) GetReadVersion ¶
func (cache *ReadVersionCache) GetReadVersion() (int64, error)
GetReadVersion returns the latest safe cached read version
func (*ReadVersionCache) SetReadVersion ¶
func (cache *ReadVersionCache) SetReadVersion(version int64) error
SetReadVersion tries to set the user-proveded commit version as a new read version
type TokenInvalidError ¶
type TokenInvalidError struct {
// contains filtered or unexported fields
}
TokenInvalidError happens when the lease token is no longer valid. It means that array ownership was changed
func NewTokenInvalidError ¶
func NewTokenInvalidError(message string) TokenInvalidError
NewTokenInvalidError creates a TokenInvalidError using the provided message
func (TokenInvalidError) Error ¶
func (e TokenInvalidError) Error() string