File: proposer.go

package info (click to toggle)
docker.io 26.1.5%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68,576 kB
  • sloc: sh: 5,748; makefile: 912; ansic: 664; asm: 228; python: 162
file content (31 lines) | stat: -rw-r--r-- 1,075 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package state

import (
	"context"

	"github.com/moby/swarmkit/v2/api"
)

// A Change includes a version number and a set of store actions from a
// particular log entry.
type Change struct {
	StoreActions []api.StoreAction
	Version      api.Version
}

// A Proposer can propose actions to a cluster.
type Proposer interface {
	// ProposeValue adds storeAction to the distributed log. If this
	// completes successfully, ProposeValue calls cb to commit the
	// proposed changes. The callback is necessary for the Proposer to make
	// sure that the changes are committed before it interacts further
	// with the store.
	ProposeValue(ctx context.Context, storeAction []api.StoreAction, cb func()) error
	// GetVersion returns the monotonic index of the most recent item in
	// the distributed log.
	GetVersion() *api.Version
	// ChangesBetween returns the changes starting after "from", up to and
	// including "to". If these changes are not available because the log
	// has been compacted, an error will be returned.
	ChangesBetween(from, to api.Version) ([]Change, error)
}