本文整理匯總了Golang中github.com/Symantec/Dominator/lib/srpc.Client.RequestReply方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.RequestReply方法的具體用法?Golang Client.RequestReply怎麽用?Golang Client.RequestReply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Symantec/Dominator/lib/srpc.Client
的用法示例。
在下文中一共展示了Client.RequestReply方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: deleteUnreferencedObjects
func deleteUnreferencedObjects(client *srpc.Client, percentage uint8,
bytes uint64) error {
request := imageserver.DeleteUnreferencedObjectsRequest{percentage, bytes}
var reply imageserver.DeleteUnreferencedObjectsResponse
return client.RequestReply("ImageServer.DeleteUnreferencedObjects",
request, &reply)
}
示例2: fetch
func fetch(srpcClient *srpc.Client, hashesFilename string) error {
hashesFile, err := os.Open(hashesFilename)
if err != nil {
return err
}
defer hashesFile.Close()
scanner := bufio.NewScanner(hashesFile)
serverAddress := fmt.Sprintf("%s:%d",
*objectServerHostname, *objectServerPortNum)
hashes := make([]hash.Hash, 0)
for scanner.Scan() {
hashval, err := objectcache.FilenameToHash(scanner.Text())
if err != nil {
return err
}
hashes = append(hashes, hashval)
}
if err := scanner.Err(); err != nil {
return err
}
return srpcClient.RequestReply("Subd.Fetch", sub.FetchRequest{
ServerAddress: serverAddress,
Wait: true,
Hashes: hashes},
&sub.FetchResponse{})
}
示例3: configureSubs
func configureSubs(client *srpc.Client) error {
var request dominator.ConfigureSubsRequest
var reply dominator.ConfigureSubsResponse
request.ScanSpeedPercent = *scanSpeedPercent
request.NetworkSpeedPercent = *networkSpeedPercent
request.ScanExclusionList = scanExcludeList
return client.RequestReply("Dominator.ConfigureSubs", request, &reply)
}
示例4: disableUpdates
func disableUpdates(client *srpc.Client, reason string) error {
if reason == "" {
return errors.New("cannot disable updates: no reason given")
}
var request dominator.DisableUpdatesRequest
var reply dominator.DisableUpdatesResponse
request.Reason = reason
return client.RequestReply("Dominator.DisableUpdates", request, &reply)
}
示例5: checkImage
func checkImage(client *srpc.Client, name string) (bool, error) {
request := imageserver.CheckImageRequest{name}
var reply imageserver.CheckImageResponse
err := client.RequestReply("ImageServer.CheckImage", request, &reply)
if err != nil {
return false, err
}
return reply.ImageExists, nil
}
示例6: setDefaultImage
func setDefaultImage(client *srpc.Client, imageName string) error {
var request dominator.SetDefaultImageRequest
var reply dominator.SetDefaultImageResponse
request.ImageName = imageName
if err := client.RequestReply("Dominator.SetDefaultImage", request,
&reply); err != nil {
return err
}
return nil
}
示例7: getSubsConfiguration
func getSubsConfiguration(client *srpc.Client) error {
var request dominator.GetSubsConfigurationRequest
var reply dominator.GetSubsConfigurationResponse
if err := client.RequestReply("Dominator.GetSubsConfiguration", request,
&reply); err != nil {
return err
}
fmt.Println(sub.Configuration(reply))
return nil
}
示例8: getDefaultImage
func getDefaultImage(client *srpc.Client) error {
var request dominator.GetDefaultImageRequest
var reply dominator.GetDefaultImageResponse
if err := client.RequestReply("Dominator.GetDefaultImage", request,
&reply); err != nil {
return err
}
if reply.ImageName != "" {
fmt.Println(reply.ImageName)
}
return nil
}
示例9: setConfiguration
func setConfiguration(client *srpc.Client, config sub.Configuration) error {
var request sub.SetConfigurationRequest
request = sub.SetConfigurationRequest(config)
var reply sub.SetConfigurationResponse
return client.RequestReply("Subd.SetConfiguration", request, &reply)
}
示例10: fetch
func fetch(client *srpc.Client, serverAddress string,
hashes []hash.Hash) error {
request := sub.FetchRequest{ServerAddress: serverAddress, Hashes: hashes}
var reply sub.FetchResponse
return client.RequestReply("Subd.Fetch", request, &reply)
}
示例11: addImage
func addImage(client *srpc.Client, name string, img *image.Image) error {
request := imageserver.AddImageRequest{name, img}
var reply imageserver.AddImageResponse
return client.RequestReply("ImageServer.AddImage", request, &reply)
}
示例12: callUpdate
func callUpdate(client *srpc.Client, request sub.UpdateRequest,
reply *sub.UpdateResponse) error {
return client.RequestReply("Subd.Update", request, reply)
}
示例13: getConfiguration
func getConfiguration(client *srpc.Client) (sub.Configuration, error) {
var request sub.GetConfigurationRequest
var reply sub.GetConfigurationResponse
err := client.RequestReply("Subd.GetConfiguration", request, &reply)
return sub.Configuration(reply), err
}
示例14: deleteImage
func deleteImage(client *srpc.Client, name string) error {
request := imageserver.DeleteImageRequest{name}
var reply imageserver.DeleteImageResponse
return client.RequestReply("ImageServer.DeleteImage", request, &reply)
}
示例15: chownDirectory
func chownDirectory(client *srpc.Client, dirname, ownerGroup string) error {
request := imageserver.ChangeOwnerRequest{DirectoryName: dirname,
OwnerGroup: ownerGroup}
var reply imageserver.ChangeOwnerResponse
return client.RequestReply("ImageServer.ChownDirectory", request, &reply)
}