本文整理汇总了Golang中github.com/coreos/etcd/storage/backend.Backend类的典型用法代码示例。如果您正苦于以下问题:Golang Backend类的具体用法?Golang Backend怎么用?Golang Backend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Backend类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: removeFrom
func (l Lease) removeFrom(b backend.Backend) {
key := int64ToBytes(int64(l.ID))
b.BatchTx().Lock()
b.BatchTx().UnsafeDelete(leaseBucketName, key)
b.BatchTx().Unlock()
}
开发者ID:adamwg,项目名称:etcd,代码行数:7,代码来源:lessor.go
示例2: mustSaveClusterVersionToBackend
func mustSaveClusterVersionToBackend(be backend.Backend, ver *semver.Version) {
ckey := backendClusterVersionKey()
tx := be.BatchTx()
tx.Lock()
defer tx.Unlock()
tx.UnsafePut(clusterBucketName, ckey, []byte(ver.String()))
}
开发者ID:xingfeng2510,项目名称:etcd,代码行数:8,代码来源:store.go
示例3: mustCreateBackendBuckets
func mustCreateBackendBuckets(be backend.Backend) {
tx := be.BatchTx()
tx.Lock()
defer tx.Unlock()
tx.UnsafeCreateBucket(membersBucketName)
tx.UnsafeCreateBucket(membersRemovedBuckedName)
tx.UnsafeCreateBucket(clusterBucketName)
}
开发者ID:xingfeng2510,项目名称:etcd,代码行数:8,代码来源:store.go
示例4: mustDeleteMemberFromBackend
func mustDeleteMemberFromBackend(be backend.Backend, id types.ID) {
mkey := backendMemberKey(id)
tx := be.BatchTx()
tx.Lock()
tx.UnsafeDelete(membersBucketName, mkey)
tx.UnsafePut(membersRemovedBuckedName, mkey, []byte("removed"))
tx.Unlock()
}
开发者ID:xingfeng2510,项目名称:etcd,代码行数:9,代码来源:store.go
示例5: NewAuthStore
func NewAuthStore(be backend.Backend) *authStore {
tx := be.BatchTx()
tx.Lock()
tx.UnsafeCreateBucket(authBucketName)
tx.Unlock()
be.ForceCommit()
return &authStore{
be: be,
}
}
开发者ID:siddontang,项目名称:etcd,代码行数:11,代码来源:store.go
示例6: mustSaveMemberToBackend
func mustSaveMemberToBackend(be backend.Backend, m *Member) {
mkey := backendMemberKey(m.ID)
mvalue, err := json.Marshal(m)
if err != nil {
plog.Panicf("marshal raftAttributes should never fail: %v", err)
}
tx := be.BatchTx()
tx.Lock()
tx.UnsafePut(membersBucketName, mkey, mvalue)
tx.Unlock()
}
开发者ID:xingfeng2510,项目名称:etcd,代码行数:12,代码来源:store.go
示例7: persistTo
func (l Lease) persistTo(b backend.Backend) {
key := int64ToBytes(int64(l.ID))
lpb := leasepb.Lease{ID: int64(l.ID), TTL: int64(l.TTL)}
val, err := lpb.Marshal()
if err != nil {
panic("failed to marshal lease proto item")
}
b.BatchTx().Lock()
b.BatchTx().UnsafePut(leaseBucketName, key, val)
b.BatchTx().Unlock()
}
开发者ID:adamwg,项目名称:etcd,代码行数:13,代码来源:lessor.go
示例8: Restore
func (s *store) Restore(b backend.Backend) error {
s.mu.Lock()
defer s.mu.Unlock()
close(s.stopc)
s.fifoSched.Stop()
s.b = b
s.kvindex = newTreeIndex()
s.currentRev = revision{main: 1}
s.compactMainRev = -1
s.tx = b.BatchTx()
s.txnID = -1
s.fifoSched = schedule.NewFIFOScheduler()
s.stopc = make(chan struct{})
return s.restore()
}
开发者ID:lebauce,项目名称:skydive,代码行数:18,代码来源:kvstore.go
示例9: Restore
func (s *store) Restore(b backend.Backend) error {
s.mu.Lock()
defer s.mu.Unlock()
close(s.stopc)
// TODO: restore without waiting for compaction routine to finish.
// We need a way to notify that the store is finished using the old
// backend though.
s.wg.Wait()
s.b = b
s.kvindex = newTreeIndex()
s.currentRev = revision{main: 1}
s.compactMainRev = -1
s.tx = b.BatchTx()
s.txnID = -1
s.stopc = make(chan struct{})
return s.restore()
}
开发者ID:lijianwei123,项目名称:etcd,代码行数:20,代码来源:kvstore.go
示例10: cleanup
func cleanup(s KV, b backend.Backend, path string) {
s.Close()
b.Close()
os.Remove(path)
}
开发者ID:xingfeng2510,项目名称:etcd,代码行数:5,代码来源:kv_test.go
注:本文中的github.com/coreos/etcd/storage/backend.Backend类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论