Documentation ¶
Index ¶
- Constants
- type Changer
- type Cluster
- type Op
- type Operation
- type Operations
- func (o *Operations) Add(op *Operation) error
- func (o *Operations) DeleteOp(id string) error
- func (o *Operations) GetOpByID(id string) (Op, error)
- func (o *Operations) GetOpByPartialID(id string) (Op, error)
- func (o *Operations) Remove(id string) error
- func (o *Operations) Run() (task.Func, task.Schedule)
- func (o *Operations) WaitOp(id string, timeout time.Duration) (bool, error)
- func (o *Operations) Walk(fn func(Op) error) error
- type Option
- type Status
Constants ¶
const Interval = 60
Interval represents the number of seconds to wait between to operational GC rounds.
const ( // Task represents a Operation classification Task class = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Changer ¶
type Changer interface { // Dispatch an event to other nodes Change(Op) }
Changer notifies other listeners whom might be listening for operational changes
type Cluster ¶
type Cluster interface { database.DBAccessor db.ClusterOpener db.ClusterTransactioner db.ClusterExclusiveLocker // NodeID sets the the node NodeID associated with this cluster instance. It's used for // backward-compatibility of all db-related APIs that were written before // clustering and don't accept a node NodeID, so in those cases we automatically // use this value as implicit node NodeID. NodeID(int64) // Close the database facade. Close() error }
Cluster mediates access to data stored in the cluster dqlite database.
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
Operation defines a operation that can be run in the background
func NewOperation ¶
NewOperation creates an operation with sane defaults
type Operations ¶
type Operations struct {
// contains filtered or unexported fields
}
Operations represents a operational collection of things that want to be run
func New ¶
func New(cluster Cluster, options ...Option) *Operations
New creates a series of operations to be worked on
func (*Operations) Add ¶
func (o *Operations) Add(op *Operation) error
Add an operation to the collection
func (*Operations) DeleteOp ¶
func (o *Operations) DeleteOp(id string) error
DeleteOp attempts to kill an operation by the id
func (*Operations) GetOpByID ¶
func (o *Operations) GetOpByID(id string) (Op, error)
GetOpByID retrieves an op of the operation from the collection by id
func (*Operations) GetOpByPartialID ¶
func (o *Operations) GetOpByPartialID(id string) (Op, error)
GetOpByPartialID retrieves an op of the operation from the collection by a partial id. As long as the prefix matches an id then it will return that operation. If the id matches multiple ids then it will return an ambiguous error.
func (*Operations) Remove ¶
func (o *Operations) Remove(id string) error
Remove an operation from the collection
func (*Operations) Run ¶
func (o *Operations) Run() (task.Func, task.Schedule)
Run returns a task function that performs operational GC checks against the internal cache of operations.
type Option ¶
type Option func(*options)
Option to be passed to Connect to customize the resulting instance.
func WithLogger ¶
WithLogger sets the logger on the option