当前位置: 首页>>代码示例>>Golang>>正文


Golang v23.GetClient函数代码示例

本文整理汇总了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))
		}
	}()
}
开发者ID:vanadium,项目名称:go.swift,代码行数:27,代码来源:swift.go

示例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
}
开发者ID:vanadium,项目名称:physical-lock,代码行数:25,代码来源:main.go

示例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
}
开发者ID:vanadium,项目名称:media-sharing,代码行数:8,代码来源:media.vdl.go

示例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
}
开发者ID:vanadium,项目名称:go.jni,代码行数:8,代码来源:fortune.vdl.go

示例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
}
开发者ID:jeffallen,项目名称:mqtt,代码行数:8,代码来源:bridge.vdl.go

示例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
}
开发者ID:vanadium,项目名称:mojo.v23proxy,代码行数:53,代码来源:clientproxy.go

示例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
}
开发者ID:vanadium,项目名称:go.jni,代码行数:4,代码来源:fortune.vdl.go

示例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
}
开发者ID:vanadium,项目名称:go.jni,代码行数:4,代码来源:fortune.vdl.go

示例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
}
开发者ID:asimshankar,项目名称:triangles,代码行数:4,代码来源:spec.vdl.go

示例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
}
开发者ID:vanadium,项目名称:go.jni,代码行数:4,代码来源:fortune.vdl.go

示例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
}
开发者ID:monopole,项目名称:volley,代码行数:4,代码来源:game.vdl.go

示例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
}
开发者ID:monopole,项目名称:volley,代码行数:4,代码来源:game.vdl.go

示例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
}
开发者ID:vanadium,项目名称:go.jni,代码行数:4,代码来源:fortune.vdl.go

示例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
}
开发者ID:vanadium,项目名称:go.jni,代码行数:4,代码来源:fortune.vdl.go

示例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
}
开发者ID:monopole,项目名称:volley,代码行数:4,代码来源:game.vdl.go


注:本文中的v/io/v23.GetClient函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。