本文整理汇总了Golang中v/io/v23.GetClient函数的典型用法代码示例。如果您正苦于以下问题:Golang GetClient函数的具体用法?Golang GetClient怎么用?Golang GetClient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetClient函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: swift_io_v_impl_google_rpc_ClientImpl_nativeStartCallAsync
//export swift_io_v_impl_google_rpc_ClientImpl_nativeStartCallAsync
func swift_io_v_impl_google_rpc_ClientImpl_nativeStartCallAsync(ctxHandle C.GoContextHandle, cName *C.char, cMethod *C.char, cVomArgs C.SwiftByteArrayArray, skipServerAuth bool, asyncId C.AsyncCallbackIdentifier, successCallback C.SwiftAsyncSuccessHandleCallback, failureCallback C.SwiftAsyncFailureCallback) {
name := C.GoString(cName)
method := C.GoString(cMethod)
ctx := scontext.GoContext(uint64(ctxHandle))
client := v23.GetClient(ctx)
// TODO Get args (we don't have VOM yet in Swift so nothing to get until then)
// args, err := decodeArgs(env, jVomArgs)
// if err != nil {
// sutil.ThrowSwiftError(ctx, err, unsafe.Pointer(errOut))
// return C.GoClientCallHandle(0)
// }
args := make([]interface{}, 0)
go func() {
result, err := doStartCall(ctx, name, method, skipServerAuth == true, client, args)
if err != nil {
var swiftVError C.SwiftVError
sutil.ThrowSwiftError(ctx, err, unsafe.Pointer(&swiftVError))
sutil.DoFailureCallback(unsafe.Pointer(failureCallback), int32(asyncId), unsafe.Pointer(&swiftVError))
} else {
handle := C.GoClientCallHandle(SwiftClientCall(result))
sutil.DoSuccessHandlerCallback(unsafe.Pointer(successCallback), int32(asyncId), uint64(handle))
}
}()
}
示例2: runSendKey
func runSendKey(ctx *context.T, env *cmdline.Env, args []string) error {
if numargs := len(args); numargs != 3 {
return fmt.Errorf("requires exactly three arguments <lock> <user> <category>, provided %d", numargs)
}
lockName, user, category := args[0], args[1], args[2]
ctx, stop, err := withLocalNamespace(ctx, "", lockUserNhName(ctx))
if err != nil {
return err
}
defer stop()
key, err := keyForLock(ctx, lockName)
if err != nil {
return err
}
fmt.Printf("Sending key %v (extended with %v) to user %v\n", key, category, user)
client := v23.GetClient(ctx)
granter := &granter{lockName: lockName, key: key, category: category, expiry: flagSendKeyExpiry, user: user}
if err := client.Call(ctx, recvKeyObjName(user), "Grant", []interface{}{lockName}, nil, granter); err != nil {
return fmt.Errorf("failed to send key to %q: %v", user, err)
}
return nil
}
示例3: DisplayBytes
func (c implMediaSharingClientStub) DisplayBytes(ctx *context.T, i0 string, opts ...rpc.CallOpt) (ocall MediaSharingDisplayBytesClientCall, err error) {
var call rpc.ClientCall
if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "DisplayBytes", []interface{}{i0}, opts...); err != nil {
return
}
ocall = &implMediaSharingDisplayBytesClientCall{ClientCall: call}
return
}
示例4: MultipleStreamingGet
func (c implFortuneClientStub) MultipleStreamingGet(ctx *context.T, opts ...rpc.CallOpt) (ocall FortuneMultipleStreamingGetClientCall, err error) {
var call rpc.ClientCall
if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "MultipleStreamingGet", nil, opts...); err != nil {
return
}
ocall = &implFortuneMultipleStreamingGetClientCall{ClientCall: call}
return
}
示例5: Link
func (c implBridgeClientStub) Link(ctx *context.T, i0 []Topic, opts ...rpc.CallOpt) (ocall BridgeLinkClientCall, err error) {
var call rpc.ClientCall
if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "Link", []interface{}{i0}, opts...); err != nil {
return
}
ocall = &implBridgeLinkClientCall{ClientCall: call}
return
}
示例6: call
func (s *messageReceiver) call(name, method string, value []byte, inParamsType mojom_types.MojomStruct, outParamsType *mojom_types.MojomStruct) ([]byte, error) {
s.ctx.Infof("server: %s.%s: %#v", name, method, inParamsType)
inVType, err := transcoder.MojomStructToVDLType(inParamsType, s.header.desc)
if err != nil {
return nil, err
}
// Decode the vom.RawBytes from the mojom bytes and mojom type.
target := util.StructSplitTarget()
if err := transcoder.FromMojo(target, value, inVType); err != nil {
return nil, fmt.Errorf("transcoder.FromMojo failed: %v", err)
}
// inVdlValue is a struct, but we need to send []interface.
inargs := target.Fields()
inargsIfc := make([]interface{}, len(inargs))
for i := range inargs {
inargsIfc[i] = inargs[i]
}
// We know that the v23serverproxy will give us back a bunch of
// data in []interface{}. so we'll want to decode them into *vom.RawBytes.
s.ctx.Infof("%s %v", method, outParamsType)
var numParams int
if outParamsType != nil {
numParams = len(outParamsType.Fields)
}
outargs := make([]*vom.RawBytes, numParams)
outptrs := make([]interface{}, len(outargs))
for i := range outargs {
outptrs[i] = &outargs[i]
}
// Now, run the call without any authorization.
if err := v23.GetClient(s.ctx).Call(s.ctx, name, method, inargsIfc, outptrs, options.ServerAuthorizer{security.AllowEveryone()}); err != nil {
return nil, err
}
if outParamsType == nil {
return nil, nil
}
outVType, err := transcoder.MojomStructToVDLType(*outParamsType, s.header.desc)
if err != nil {
return nil, err
}
toMojoTarget := transcoder.ToMojomTarget()
if err := util.JoinRawBytesAsStruct(toMojoTarget, outVType, outargs); err != nil {
return nil, err
}
return toMojoTarget.Bytes(), nil
}
示例7: ParameterizedGet
func (c implFortuneClientStub) ParameterizedGet(ctx *context.T, opts ...rpc.CallOpt) (o0 map[string]string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "ParameterizedGet", nil, []interface{}{&o0}, opts...)
return
}
示例8: MultipleGet
func (c implFortuneClientStub) MultipleGet(ctx *context.T, opts ...rpc.CallOpt) (o0 string, o1 string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "MultipleGet", nil, []interface{}{&o0, &o1}, opts...)
return
}
示例9: Give
func (c implScreenClientStub) Give(ctx *context.T, i0 Triangle, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Give", []interface{}{i0}, nil, opts...)
return
}
示例10: Add
func (c implFortuneClientStub) Add(ctx *context.T, i0 string, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Add", []interface{}{i0}, nil, opts...)
return
}
示例11: DoMasterCommand
func (c implGameServiceClientStub) DoMasterCommand(ctx *context.T, i0 MasterCommand, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "DoMasterCommand", []interface{}{i0}, nil, opts...)
return
}
示例12: Quit
func (c implGameServiceClientStub) Quit(ctx *context.T, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Quit", nil, nil, opts...)
return
}
示例13: GetServerThread
func (c implFortuneClientStub) GetServerThread(ctx *context.T, opts ...rpc.CallOpt) (o0 string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "GetServerThread", nil, []interface{}{&o0}, opts...)
return
}
示例14: NoTags
func (c implFortuneClientStub) NoTags(ctx *context.T, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "NoTags", nil, nil, opts...)
return
}
示例15: SetGravity
func (c implGameServiceClientStub) SetGravity(ctx *context.T, i0 float32, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "SetGravity", []interface{}{i0}, nil, opts...)
return
}