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 }
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 }
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 }
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 }
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 } }
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 }