mirror of
https://github.com/moby/moby.git
synced 2026-07-11 18:13:57 +00:00
This fix tries to update the SwarmKit from ed384f3b3957f65e3111bd020f9815f3d4296fa2 to 6bc357e9c5f0ac2cdf801898a43d08c260b4d5d0 The following is the list of docker related changes: 1. Took long time for Docker Swarm service turn desired state from Ready to Running (Issue #28291) 2. Native Swarm in 1.12 - panic: runtime error: index out of range (Issue #25608) 3. Global mode target replicas keep increasing (Issue #30854) 4. Creating service with publish mode=host and without published port crashes swarm manager (Issue #30938) 5. Define signals used to stop containers for updates (Issue #25696) (PR #30754) This fix fixes #28291, #25608, #30854, #30938. This fix is required by PR #30754. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
33 lines
1.4 KiB
Go
33 lines
1.4 KiB
Go
// Package state provides interfaces to work with swarm cluster state.
|
|
//
|
|
// The primary interface is Store, which abstracts storage of this cluster
|
|
// state. Store exposes a transactional interface for both reads and writes.
|
|
// To perform a read transaction, View accepts a callback function that it
|
|
// will invoke with a ReadTx object that gives it a consistent view of the
|
|
// state. Similarly, Update accepts a callback function that it will invoke with
|
|
// a Tx object that allows reads and writes to happen without interference from
|
|
// other transactions.
|
|
//
|
|
// This is an example of making an update to a Store:
|
|
//
|
|
// err := store.Update(func(tx state.Tx) {
|
|
// if err := tx.Nodes().Update(newNode); err != nil {
|
|
// return err
|
|
// }
|
|
// return nil
|
|
// })
|
|
// if err != nil {
|
|
// return fmt.Errorf("transaction failed: %v", err)
|
|
// }
|
|
//
|
|
// WatchableStore is a version of Store that exposes watch functionality.
|
|
// These expose a publish/subscribe queue where code can subscribe to
|
|
// changes of interest. This can be combined with the ViewAndWatch function to
|
|
// "fork" a store, by making a snapshot and then applying future changes
|
|
// to keep the copy in sync. This approach lets consumers of the data
|
|
// use their own data structures and implement their own concurrency
|
|
// strategies. It can lead to more efficient code because data consumers
|
|
// don't necessarily have to lock the main data store if they are
|
|
// maintaining their own copies of the state.
|
|
package state
|