MCPcopy
hub / github.com/fagongzi/manba / getValue

Method getValue

pkg/store/store_etcd.go:905–919  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

903}
904
905func (e *EtcdStore) getValue(key string) ([]byte, error) {
906 ctx, cancel := context.WithTimeout(e.rawClient.Ctx(), DefaultRequestTimeout)
907 defer cancel()
908
909 resp, err := clientv3.NewKV(e.rawClient).Get(ctx, key)
910 if nil != err {
911 return nil, err
912 }
913
914 if len(resp.Kvs) == 0 {
915 return nil, nil
916 }
917
918 return resp.Kvs[0].Value, nil
919}
920
921func (e *EtcdStore) allocID() (uint64, error) {
922 e.idLock.Lock()

Callers 2

getPBMethod · 0.95
getIDMethod · 0.95

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected