本文整理匯總了Golang中github.com/docker/swarmkit/manager/state/store.MemoryStore.Update方法的典型用法代碼示例。如果您正苦於以下問題:Golang MemoryStore.Update方法的具體用法?Golang MemoryStore.Update怎麽用?Golang MemoryStore.Update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/docker/swarmkit/manager/state/store.MemoryStore
的用法示例。
在下文中一共展示了MemoryStore.Update方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createCluster
func createCluster(t *testing.T, s *store.MemoryStore, id, name string) *api.Cluster {
spec := createClusterSpec(name)
cluster := &api.Cluster{
ID: id,
Spec: *spec,
}
assert.NoError(t, s.Update(func(tx store.Tx) error {
return store.CreateCluster(tx, cluster)
}))
return cluster
}
示例2: createClusterObject
func createClusterObject(t *testing.T, s *store.MemoryStore, acceptancePolicy api.AcceptancePolicy) {
assert.NoError(t, s.Update(func(tx store.Tx) error {
store.CreateCluster(tx, &api.Cluster{
ID: identity.NewID(),
Spec: api.ClusterSpec{
Annotations: api.Annotations{
Name: store.DefaultClusterName,
},
AcceptancePolicy: acceptancePolicy,
},
})
return nil
}))
}
示例3: createClusterObject
func createClusterObject(t *testing.T, s *store.MemoryStore, clusterID string, acceptancePolicy api.AcceptancePolicy, externalCAs ...*api.ExternalCA) {
assert.NoError(t, s.Update(func(tx store.Tx) error {
store.CreateCluster(tx, &api.Cluster{
ID: clusterID,
Spec: api.ClusterSpec{
Annotations: api.Annotations{
Name: store.DefaultClusterName,
},
AcceptancePolicy: acceptancePolicy,
CAConfig: api.CAConfig{
ExternalCAs: externalCAs,
},
},
})
return nil
}))
}