本文整理汇总了Golang中github.com/cmu440/tribbler/rpc/storagerpc.PutArgs类的典型用法代码示例。如果您正苦于以下问题:Golang PutArgs类的具体用法?Golang PutArgs怎么用?Golang PutArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PutArgs类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: AppendToList
func (ls *libstore) AppendToList(key, newItem string) error {
var args storagerpc.PutArgs
var reply storagerpc.PutReply
args.Key = key
args.Value = newItem
// pick the right server
cli, err := ls.GetServer(key)
if err != nil {
return err
}
// call rpc to storage server
err = cli.Call("StorageServer.AppendToList", &args, &reply)
if err != nil {
return err
}
// check the reply status
if reply.Status != storagerpc.OK {
err = GetErrorType(reply.Status)
return err
}
return nil
}
开发者ID:oldady,项目名称:Tribbler,代码行数:27,代码来源:libstore_impl.go
示例2: Put
func (ls *libstore) Put(key, value string) error {
// Get the right server
cli, err := ls.GetServer(key)
if err != nil {
return err
}
var args storagerpc.PutArgs
var reply storagerpc.PutReply
args.Key = key
args.Value = value
// call rpc put to storage server
err = cli.Call("StorageServer.Put", &args, &reply)
if err != nil {
return err
}
if reply.Status != storagerpc.OK {
err = GetErrorType(reply.Status)
return err
}
return nil
}
开发者ID:oldady,项目名称:Tribbler,代码行数:26,代码来源:libstore_impl.go
示例3: AppendToList
func (ls *libstore) AppendToList(key, newItem string) error {
var args storagerpc.PutArgs
var reply storagerpc.PutReply
args.Key = key
args.Value = newItem
target_server := ls.GetServerIndex(key)
ls.rpc_connection[target_server].Call("StorageServer.AppendToList", args, &reply)
if reply.Status != storagerpc.OK {
return errors.New("Error in AppendToList")
}
return nil
}
开发者ID:mallocanswer,项目名称:Tribbler,代码行数:13,代码来源:libstore_impl.go
示例4: Put
func (ls *libstore) Put(key, value string) error {
var args storagerpc.PutArgs
var reply storagerpc.PutReply
args.Key = key
args.Value = value
target_server := ls.GetServerIndex(key)
ls.rpc_connection[target_server].Call("StorageServer.Put", args, &reply)
if reply.Status != storagerpc.OK {
return errors.New("Error in put operation")
}
return nil
}
开发者ID:mallocanswer,项目名称:Tribbler,代码行数:13,代码来源:libstore_impl.go
示例5: RemoveFromList
func (ls *libstore) RemoveFromList(key, removeItem string) error {
var args storagerpc.PutArgs
var reply storagerpc.PutReply
args.Key = key
args.Value = removeItem
target_server := ls.GetServerIndex(key)
ls.rpc_connection[target_server].Call("StorageServer.RemoveFromList", args, &reply)
if reply.Status != storagerpc.OK {
return errors.New("Error in RemoveFromList")
} else {
return nil
}
}
开发者ID:mallocanswer,项目名称:Tribbler,代码行数:14,代码来源:libstore_impl.go
示例6: RemoveFromList
func (ls *libstore) RemoveFromList(key, removeItem string) error {
var args storagerpc.PutArgs
var reply storagerpc.PutReply
args.Key = key
args.Value = removeItem
cli, err := ls.GetServer(key)
if err != nil {
return err
}
err = cli.Call("StorageServer.RemoveFromList", &args, &reply)
if err != nil {
return err
}
if reply.Status != storagerpc.OK {
err = GetErrorType(reply.Status)
return err
}
return nil
}
开发者ID:201101050424,项目名称:Tribbler,代码行数:24,代码来源:libstore_impl.go
注:本文中的github.com/cmu440/tribbler/rpc/storagerpc.PutArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论