本文整理汇总了Golang中P3-f12/official/storageproto.PutReply类的典型用法代码示例。如果您正苦于以下问题:Golang PutReply类的具体用法?Golang PutReply怎么用?Golang PutReply使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PutReply类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RemoveFromList
// RemoveFromList
// function:
// - remove key and list value from storage
func (ss *Storageserver) RemoveFromList(args *storageproto.PutArgs, reply *storageproto.PutReply) error {
req := &cacheReq{REMOVE_LIST_VALUE, args.Key, args.Value}
replyc := make(chan interface{})
ss.cacheReqC <- Request{req, replyc}
status := (<-replyc).(bool)
if status {
lsplog.Vlogf(5, "Remove key successfully %s %s", args.Key, args.Value)
reply.Status = storageproto.OK
} else {
lsplog.Vlogf(5, "Remove key failed %s %s", args.Key, args.Value)
reply.Status = storageproto.EITEMNOTFOUND
}
return nil
}
示例2: AppendToList
// AppendToList
// function:
// - put key and list value into storage
func (ss *Storageserver) AppendToList(args *storageproto.PutArgs, reply *storageproto.PutReply) error {
req := &cacheReq{APPEND_LIST_VALUE, args.Key, args.Value}
replyc := make(chan interface{})
ss.cacheReqC <- Request{req, replyc}
status := (<-replyc).(bool)
if status {
lsplog.Vlogf(5, "Append key successfully %s %s", args.Key, args.Value)
reply.Status = storageproto.OK
} else {
lsplog.Vlogf(5, "Append key failed %s %s", args.Key, args.Value)
reply.Status = storageproto.EITEMEXISTS
}
return nil
}
示例3: Put
// Put
// function:
// - put key value into storage
func (ss *Storageserver) Put(args *storageproto.PutArgs, reply *storageproto.PutReply) error {
req := &cacheReq{PUT_VALUE, args.Key, args.Value}
replyc := make(chan interface{})
ss.cacheReqC <- Request{req, replyc}
<-replyc
lsplog.Vlogf(5, "Put key successfully %s %s", args.Key, args.Value)
reply.Status = storageproto.OK
return nil
}
示例4: RemoveFromList
func (pc *ProxyCounter) RemoveFromList(args *storageproto.PutArgs, reply *storageproto.PutReply) error {
if pc.override {
reply.Status = pc.overrideStatus
return pc.overrideErr
}
byteCount := len(args.Key) + len(args.Value)
err := pc.srv.Call("StorageRPC.RemoveFromList", args, reply)
atomic.AddUint32(&pc.rpcCount, 1)
atomic.AddUint32(&pc.byteCount, uint32(byteCount))
return err
}