| // This file was auto-generated by the veyron vdl tool. |
| // Source: cache.vdl |
| |
| package sample |
| |
| import ( |
| // The non-user imports are prefixed with "_gen_" to prevent collisions. |
| _gen_io "io" |
| _gen_veyron2 "veyron2" |
| _gen_context "veyron2/context" |
| _gen_ipc "veyron2/ipc" |
| _gen_naming "veyron2/naming" |
| _gen_vdlutil "veyron2/vdl/vdlutil" |
| _gen_wiretype "veyron2/wiretype" |
| ) |
| |
| // KeyValuePair is a representation of a cached key and value pair. |
| type KeyValuePair struct { |
| Key string |
| Value _gen_vdlutil.Any |
| } |
| |
| // TODO(bprosnitz) Remove this line once signatures are updated to use typevals. |
| // It corrects a bug where _gen_wiretype is unused in VDL pacakges where only bootstrap types are used on interfaces. |
| const _ = _gen_wiretype.TypeIDInvalid |
| |
| // A Cache service mimics the memcache interface. |
| // Cache is the interface the client binds and uses. |
| // Cache_ExcludingUniversal is the interface without internal framework-added methods |
| // to enable embedding without method collisions. Not to be used directly by clients. |
| type Cache_ExcludingUniversal interface { |
| // Set sets a value for a key. |
| Set(ctx _gen_context.T, key string, value _gen_vdlutil.Any, opts ..._gen_ipc.CallOpt) (err error) |
| // Get returns the value for a key. If the value is not found, returns |
| // a not found error. |
| Get(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply _gen_vdlutil.Any, err error) |
| // Same as Get, but casts the return argument to an byte. |
| GetAsByte(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply byte, err error) |
| // Same as Get, but casts the return argument to an int32. |
| GetAsInt32(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply int32, err error) |
| // Same as Get, but casts the return argument to an int64. |
| GetAsInt64(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply int64, err error) |
| // Same as Get, but casts the return argument to an uint32. |
| GetAsUint32(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply uint32, err error) |
| // Same as Get, but casts the return argument to an uint64. |
| GetAsUint64(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply uint64, err error) |
| // Same as Get, but casts the return argument to an float32. |
| GetAsFloat32(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply float32, err error) |
| // Same as Get, but casts the return argument to an float64. |
| GetAsFloat64(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply float64, err error) |
| // Same as Get, but casts the return argument to a string. |
| GetAsString(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply string, err error) |
| // Same as Get, but casts the return argument to a bool. |
| GetAsBool(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply bool, err error) |
| // Same as Get, but casts the return argument to an error. |
| GetAsError(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply error, err error) |
| // AsMap returns the full contents of the cache as a map. |
| AsMap(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply map[string]_gen_vdlutil.Any, err error) |
| // KeyValuePairs returns the full contents of the cache as a slice of pairs. |
| KeyValuePairs(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []KeyValuePair, err error) |
| // MostRecentSet returns the key and value and the timestamp for the most |
| // recent set operation |
| // TODO(bprosnitz) support type types and change time to native time type |
| MostRecentSet(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (value KeyValuePair, time int64, err error) |
| // KeyPage indexes into the keys (in alphanumerically sorted order) and |
| // returns the indexth page of 10 keys. |
| KeyPage(ctx _gen_context.T, index int64, opts ..._gen_ipc.CallOpt) (reply [10]string, err error) |
| // Size returns the total number of entries in the cache. |
| Size(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply int64, err error) |
| // MultiGet sets up a stream that allows fetching multiple keys. |
| MultiGet(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply CacheMultiGetCall, err error) |
| } |
| type Cache interface { |
| _gen_ipc.UniversalServiceMethods |
| Cache_ExcludingUniversal |
| } |
| |
| // CacheService is the interface the server implements. |
| type CacheService interface { |
| |
| // Set sets a value for a key. |
| Set(context _gen_ipc.ServerContext, key string, value _gen_vdlutil.Any) (err error) |
| // Get returns the value for a key. If the value is not found, returns |
| // a not found error. |
| Get(context _gen_ipc.ServerContext, key string) (reply _gen_vdlutil.Any, err error) |
| // Same as Get, but casts the return argument to an byte. |
| GetAsByte(context _gen_ipc.ServerContext, key string) (reply byte, err error) |
| // Same as Get, but casts the return argument to an int32. |
| GetAsInt32(context _gen_ipc.ServerContext, key string) (reply int32, err error) |
| // Same as Get, but casts the return argument to an int64. |
| GetAsInt64(context _gen_ipc.ServerContext, key string) (reply int64, err error) |
| // Same as Get, but casts the return argument to an uint32. |
| GetAsUint32(context _gen_ipc.ServerContext, key string) (reply uint32, err error) |
| // Same as Get, but casts the return argument to an uint64. |
| GetAsUint64(context _gen_ipc.ServerContext, key string) (reply uint64, err error) |
| // Same as Get, but casts the return argument to an float32. |
| GetAsFloat32(context _gen_ipc.ServerContext, key string) (reply float32, err error) |
| // Same as Get, but casts the return argument to an float64. |
| GetAsFloat64(context _gen_ipc.ServerContext, key string) (reply float64, err error) |
| // Same as Get, but casts the return argument to a string. |
| GetAsString(context _gen_ipc.ServerContext, key string) (reply string, err error) |
| // Same as Get, but casts the return argument to a bool. |
| GetAsBool(context _gen_ipc.ServerContext, key string) (reply bool, err error) |
| // Same as Get, but casts the return argument to an error. |
| GetAsError(context _gen_ipc.ServerContext, key string) (reply error, err error) |
| // AsMap returns the full contents of the cache as a map. |
| AsMap(context _gen_ipc.ServerContext) (reply map[string]_gen_vdlutil.Any, err error) |
| // KeyValuePairs returns the full contents of the cache as a slice of pairs. |
| KeyValuePairs(context _gen_ipc.ServerContext) (reply []KeyValuePair, err error) |
| // MostRecentSet returns the key and value and the timestamp for the most |
| // recent set operation |
| // TODO(bprosnitz) support type types and change time to native time type |
| MostRecentSet(context _gen_ipc.ServerContext) (value KeyValuePair, time int64, err error) |
| // KeyPage indexes into the keys (in alphanumerically sorted order) and |
| // returns the indexth page of 10 keys. |
| KeyPage(context _gen_ipc.ServerContext, index int64) (reply [10]string, err error) |
| // Size returns the total number of entries in the cache. |
| Size(context _gen_ipc.ServerContext) (reply int64, err error) |
| // MultiGet sets up a stream that allows fetching multiple keys. |
| MultiGet(context _gen_ipc.ServerContext, stream CacheServiceMultiGetStream) (err error) |
| } |
| |
| // CacheMultiGetCall is the interface for call object of the method |
| // MultiGet in the service interface Cache. |
| type CacheMultiGetCall interface { |
| // RecvStream returns the recv portion of the stream |
| RecvStream() interface { |
| // Advance stages an element so the client can retrieve it |
| // with Value. Advance returns true iff there is an |
| // element to retrieve. The client must call Advance before |
| // calling Value. Advance may block if an element is not |
| // immediately available. |
| Advance() bool |
| |
| // Value returns the element that was staged by Advance. |
| // Value may panic if Advance returned false or was not |
| // called at all. Value does not block. |
| Value() _gen_vdlutil.Any |
| |
| // Err returns a non-nil error iff the stream encountered |
| // any errors. Err does not block. |
| Err() error |
| } |
| |
| // SendStream returns the send portion of the stream |
| SendStream() interface { |
| // Send places the item onto the output stream, blocking if there is no |
| // buffer space available. Calls to Send after having called Close |
| // or Cancel will fail. Any blocked Send calls will be unblocked upon |
| // calling Cancel. |
| Send(item string) error |
| |
| // Close indicates to the server that no more items will be sent; |
| // server Recv calls will receive io.EOF after all sent items. This is |
| // an optional call - it's used by streaming clients that need the |
| // server to receive the io.EOF terminator before the client calls |
| // Finish (for example, if the client needs to continue receiving items |
| // from the server after having finished sending). |
| // Calls to Close after having called Cancel will fail. |
| // Like Send, Close blocks when there's no buffer space available. |
| Close() error |
| } |
| |
| // Finish performs the equivalent of SendStream().Close, then blocks until the server |
| // is done, and returns the positional return values for call. |
| // If Cancel has been called, Finish will return immediately; the output of |
| // Finish could either be an error signalling cancelation, or the correct |
| // positional return values from the server depending on the timing of the |
| // call. |
| // |
| // Calling Finish is mandatory for releasing stream resources, unless Cancel |
| // has been called or any of the other methods return an error. |
| // Finish should be called at most once. |
| Finish() (err error) |
| |
| // Cancel cancels the RPC, notifying the server to stop processing. It |
| // is safe to call Cancel concurrently with any of the other stream methods. |
| // Calling Cancel after Finish has returned is a no-op. |
| Cancel() |
| } |
| |
| type implCacheMultiGetStreamSender struct { |
| clientCall _gen_ipc.Call |
| } |
| |
| func (c *implCacheMultiGetStreamSender) Send(item string) error { |
| return c.clientCall.Send(item) |
| } |
| |
| func (c *implCacheMultiGetStreamSender) Close() error { |
| return c.clientCall.CloseSend() |
| } |
| |
| type implCacheMultiGetStreamIterator struct { |
| clientCall _gen_ipc.Call |
| val _gen_vdlutil.Any |
| err error |
| } |
| |
| func (c *implCacheMultiGetStreamIterator) Advance() bool { |
| c.val = nil |
| c.err = c.clientCall.Recv(&c.val) |
| return c.err == nil |
| } |
| |
| func (c *implCacheMultiGetStreamIterator) Value() _gen_vdlutil.Any { |
| return c.val |
| } |
| |
| func (c *implCacheMultiGetStreamIterator) Err() error { |
| if c.err == _gen_io.EOF { |
| return nil |
| } |
| return c.err |
| } |
| |
| // Implementation of the CacheMultiGetCall interface that is not exported. |
| type implCacheMultiGetCall struct { |
| clientCall _gen_ipc.Call |
| writeStream implCacheMultiGetStreamSender |
| readStream implCacheMultiGetStreamIterator |
| } |
| |
| func (c *implCacheMultiGetCall) SendStream() interface { |
| Send(item string) error |
| Close() error |
| } { |
| return &c.writeStream |
| } |
| |
| func (c *implCacheMultiGetCall) RecvStream() interface { |
| Advance() bool |
| Value() _gen_vdlutil.Any |
| Err() error |
| } { |
| return &c.readStream |
| } |
| |
| func (c *implCacheMultiGetCall) Finish() (err error) { |
| if ierr := c.clientCall.Finish(&err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (c *implCacheMultiGetCall) Cancel() { |
| c.clientCall.Cancel() |
| } |
| |
| type implCacheServiceMultiGetStreamSender struct { |
| serverCall _gen_ipc.ServerCall |
| } |
| |
| func (s *implCacheServiceMultiGetStreamSender) Send(item _gen_vdlutil.Any) error { |
| return s.serverCall.Send(item) |
| } |
| |
| type implCacheServiceMultiGetStreamIterator struct { |
| serverCall _gen_ipc.ServerCall |
| val string |
| err error |
| } |
| |
| func (s *implCacheServiceMultiGetStreamIterator) Advance() bool { |
| s.err = s.serverCall.Recv(&s.val) |
| return s.err == nil |
| } |
| |
| func (s *implCacheServiceMultiGetStreamIterator) Value() string { |
| return s.val |
| } |
| |
| func (s *implCacheServiceMultiGetStreamIterator) Err() error { |
| if s.err == _gen_io.EOF { |
| return nil |
| } |
| return s.err |
| } |
| |
| // CacheServiceMultiGetStream is the interface for streaming responses of the method |
| // MultiGet in the service interface Cache. |
| type CacheServiceMultiGetStream interface { |
| // SendStream returns the send portion of the stream. |
| SendStream() interface { |
| // Send places the item onto the output stream, blocking if there is no buffer |
| // space available. If the client has canceled, an error is returned. |
| Send(item _gen_vdlutil.Any) error |
| } |
| // RecvStream returns the recv portion of the stream |
| RecvStream() interface { |
| // Advance stages an element so the client can retrieve it |
| // with Value. Advance returns true iff there is an |
| // element to retrieve. The client must call Advance before |
| // calling Value. Advance may block if an element is not |
| // immediately available. |
| Advance() bool |
| |
| // Value returns the element that was staged by Advance. |
| // Value may panic if Advance returned false or was not |
| // called at all. Value does not block. |
| Value() string |
| |
| // Err returns a non-nil error iff the stream encountered |
| // any errors. Err does not block. |
| Err() error |
| } |
| } |
| |
| // Implementation of the CacheServiceMultiGetStream interface that is not exported. |
| type implCacheServiceMultiGetStream struct { |
| writer implCacheServiceMultiGetStreamSender |
| reader implCacheServiceMultiGetStreamIterator |
| } |
| |
| func (s *implCacheServiceMultiGetStream) SendStream() interface { |
| // Send places the item onto the output stream, blocking if there is no buffer |
| // space available. If the client has canceled, an error is returned. |
| Send(item _gen_vdlutil.Any) error |
| } { |
| return &s.writer |
| } |
| |
| func (s *implCacheServiceMultiGetStream) RecvStream() interface { |
| // Advance stages an element so the client can retrieve it |
| // with Value. Advance returns true iff there is an |
| // element to retrieve. The client must call Advance before |
| // calling Value. The client must call Cancel if it does |
| // not iterate through all elements (i.e. until Advance |
| // returns false). Advance may block if an element is not |
| // immediately available. |
| Advance() bool |
| |
| // Value returns the element that was staged by Advance. |
| // Value may panic if Advance returned false or was not |
| // called at all. Value does not block. |
| Value() string |
| |
| // Err returns a non-nil error iff the stream encountered |
| // any errors. Err does not block. |
| Err() error |
| } { |
| return &s.reader |
| } |
| |
| // BindCache returns the client stub implementing the Cache |
| // interface. |
| // |
| // If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the |
| // global Runtime is used. |
| func BindCache(name string, opts ..._gen_ipc.BindOpt) (Cache, error) { |
| var client _gen_ipc.Client |
| switch len(opts) { |
| case 0: |
| // Do nothing. |
| case 1: |
| if clientOpt, ok := opts[0].(_gen_ipc.Client); opts[0] == nil || ok { |
| client = clientOpt |
| } else { |
| return nil, _gen_vdlutil.ErrUnrecognizedOption |
| } |
| default: |
| return nil, _gen_vdlutil.ErrTooManyOptionsToBind |
| } |
| stub := &clientStubCache{defaultClient: client, name: name} |
| |
| return stub, nil |
| } |
| |
| // NewServerCache creates a new server stub. |
| // |
| // It takes a regular server implementing the CacheService |
| // interface, and returns a new server stub. |
| func NewServerCache(server CacheService) interface{} { |
| return &ServerStubCache{ |
| service: server, |
| } |
| } |
| |
| // clientStubCache implements Cache. |
| type clientStubCache struct { |
| defaultClient _gen_ipc.Client |
| name string |
| } |
| |
| func (__gen_c *clientStubCache) client(ctx _gen_context.T) _gen_ipc.Client { |
| if __gen_c.defaultClient != nil { |
| return __gen_c.defaultClient |
| } |
| return _gen_veyron2.RuntimeFromContext(ctx).Client() |
| } |
| |
| func (__gen_c *clientStubCache) Set(ctx _gen_context.T, key string, value _gen_vdlutil.Any, opts ..._gen_ipc.CallOpt) (err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Set", []interface{}{key, value}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) Get(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply _gen_vdlutil.Any, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Get", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsByte(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply byte, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsByte", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsInt32(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply int32, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsInt32", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsInt64(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply int64, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsInt64", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsUint32(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply uint32, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsUint32", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsUint64(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply uint64, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsUint64", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsFloat32(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply float32, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsFloat32", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsFloat64(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply float64, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsFloat64", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsString(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply string, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsString", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsBool(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply bool, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsBool", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetAsError(ctx _gen_context.T, key string, opts ..._gen_ipc.CallOpt) (reply error, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetAsError", []interface{}{key}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) AsMap(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply map[string]_gen_vdlutil.Any, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "AsMap", nil, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) KeyValuePairs(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []KeyValuePair, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "KeyValuePairs", nil, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) MostRecentSet(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (value KeyValuePair, time int64, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "MostRecentSet", nil, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&value, &time, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) KeyPage(ctx _gen_context.T, index int64, opts ..._gen_ipc.CallOpt) (reply [10]string, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "KeyPage", []interface{}{index}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) Size(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply int64, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Size", nil, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) MultiGet(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply CacheMultiGetCall, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "MultiGet", nil, opts...); err != nil { |
| return |
| } |
| reply = &implCacheMultiGetCall{clientCall: call, writeStream: implCacheMultiGetStreamSender{clientCall: call}, readStream: implCacheMultiGetStreamIterator{clientCall: call}} |
| return |
| } |
| |
| func (__gen_c *clientStubCache) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| func (__gen_c *clientStubCache) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) { |
| var call _gen_ipc.Call |
| if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil { |
| return |
| } |
| if ierr := call.Finish(&reply, &err); ierr != nil { |
| err = ierr |
| } |
| return |
| } |
| |
| // ServerStubCache wraps a server that implements |
| // CacheService and provides an object that satisfies |
| // the requirements of veyron2/ipc.ReflectInvoker. |
| type ServerStubCache struct { |
| service CacheService |
| } |
| |
| func (__gen_s *ServerStubCache) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) { |
| // TODO(bprosnitz) GetMethodTags() will be replaces with Signature(). |
| // Note: This exhibits some weird behavior like returning a nil error if the method isn't found. |
| // This will change when it is replaced with Signature(). |
| switch method { |
| case "Set": |
| return []interface{}{}, nil |
| case "Get": |
| return []interface{}{}, nil |
| case "GetAsByte": |
| return []interface{}{}, nil |
| case "GetAsInt32": |
| return []interface{}{}, nil |
| case "GetAsInt64": |
| return []interface{}{}, nil |
| case "GetAsUint32": |
| return []interface{}{}, nil |
| case "GetAsUint64": |
| return []interface{}{}, nil |
| case "GetAsFloat32": |
| return []interface{}{}, nil |
| case "GetAsFloat64": |
| return []interface{}{}, nil |
| case "GetAsString": |
| return []interface{}{}, nil |
| case "GetAsBool": |
| return []interface{}{}, nil |
| case "GetAsError": |
| return []interface{}{}, nil |
| case "AsMap": |
| return []interface{}{}, nil |
| case "KeyValuePairs": |
| return []interface{}{}, nil |
| case "MostRecentSet": |
| return []interface{}{}, nil |
| case "KeyPage": |
| return []interface{}{}, nil |
| case "Size": |
| return []interface{}{}, nil |
| case "MultiGet": |
| return []interface{}{}, nil |
| default: |
| return nil, nil |
| } |
| } |
| |
| func (__gen_s *ServerStubCache) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) { |
| result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)} |
| result.Methods["AsMap"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{}, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 68}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["Get"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 65}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsBool"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 2}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsByte"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 67}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsError"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 66}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsFloat32"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 25}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsFloat64"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 26}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsInt32"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 36}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsInt64"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 37}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsString"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 3}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsUint32"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 52}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["GetAsUint64"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 53}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["KeyPage"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "index", Type: 37}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 71}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["KeyValuePairs"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{}, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 70}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["MostRecentSet"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{}, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "value", Type: 69}, |
| {Name: "time", Type: 37}, |
| {Name: "err", Type: 66}, |
| }, |
| } |
| result.Methods["MultiGet"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{}, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 66}, |
| }, |
| InStream: 3, |
| OutStream: 65, |
| } |
| result.Methods["Set"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{ |
| {Name: "key", Type: 3}, |
| {Name: "value", Type: 65}, |
| }, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 66}, |
| }, |
| } |
| result.Methods["Size"] = _gen_ipc.MethodSignature{ |
| InArgs: []_gen_ipc.MethodArgument{}, |
| OutArgs: []_gen_ipc.MethodArgument{ |
| {Name: "", Type: 37}, |
| {Name: "", Type: 66}, |
| }, |
| } |
| |
| result.TypeDefs = []_gen_vdlutil.Any{ |
| _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "anydata", Tags: []string(nil)}, _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}, _gen_wiretype.NamedPrimitiveType{Type: 0x32, Name: "byte", Tags: []string(nil)}, _gen_wiretype.MapType{Key: 0x3, Elem: 0x41, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{ |
| []_gen_wiretype.FieldType{ |
| _gen_wiretype.FieldType{Type: 0x3, Name: "Key"}, |
| _gen_wiretype.FieldType{Type: 0x41, Name: "Value"}, |
| }, |
| "veyron/examples/wspr_sample.KeyValuePair", []string(nil)}, |
| _gen_wiretype.SliceType{Elem: 0x45, Name: "", Tags: []string(nil)}, _gen_wiretype.ArrayType{Elem: 0x3, Len: 0xa, Name: "", Tags: []string(nil)}} |
| |
| return result, nil |
| } |
| |
| func (__gen_s *ServerStubCache) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) { |
| if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok { |
| return unresolver.UnresolveStep(call) |
| } |
| if call.Server() == nil { |
| return |
| } |
| var published []string |
| if published, err = call.Server().Published(); err != nil || published == nil { |
| return |
| } |
| reply = make([]string, len(published)) |
| for i, p := range published { |
| reply[i] = _gen_naming.Join(p, call.Name()) |
| } |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) Set(call _gen_ipc.ServerCall, key string, value _gen_vdlutil.Any) (err error) { |
| err = __gen_s.service.Set(call, key, value) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) Get(call _gen_ipc.ServerCall, key string) (reply _gen_vdlutil.Any, err error) { |
| reply, err = __gen_s.service.Get(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsByte(call _gen_ipc.ServerCall, key string) (reply byte, err error) { |
| reply, err = __gen_s.service.GetAsByte(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsInt32(call _gen_ipc.ServerCall, key string) (reply int32, err error) { |
| reply, err = __gen_s.service.GetAsInt32(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsInt64(call _gen_ipc.ServerCall, key string) (reply int64, err error) { |
| reply, err = __gen_s.service.GetAsInt64(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsUint32(call _gen_ipc.ServerCall, key string) (reply uint32, err error) { |
| reply, err = __gen_s.service.GetAsUint32(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsUint64(call _gen_ipc.ServerCall, key string) (reply uint64, err error) { |
| reply, err = __gen_s.service.GetAsUint64(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsFloat32(call _gen_ipc.ServerCall, key string) (reply float32, err error) { |
| reply, err = __gen_s.service.GetAsFloat32(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsFloat64(call _gen_ipc.ServerCall, key string) (reply float64, err error) { |
| reply, err = __gen_s.service.GetAsFloat64(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsString(call _gen_ipc.ServerCall, key string) (reply string, err error) { |
| reply, err = __gen_s.service.GetAsString(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsBool(call _gen_ipc.ServerCall, key string) (reply bool, err error) { |
| reply, err = __gen_s.service.GetAsBool(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) GetAsError(call _gen_ipc.ServerCall, key string) (reply error, err error) { |
| reply, err = __gen_s.service.GetAsError(call, key) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) AsMap(call _gen_ipc.ServerCall) (reply map[string]_gen_vdlutil.Any, err error) { |
| reply, err = __gen_s.service.AsMap(call) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) KeyValuePairs(call _gen_ipc.ServerCall) (reply []KeyValuePair, err error) { |
| reply, err = __gen_s.service.KeyValuePairs(call) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) MostRecentSet(call _gen_ipc.ServerCall) (value KeyValuePair, time int64, err error) { |
| value, time, err = __gen_s.service.MostRecentSet(call) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) KeyPage(call _gen_ipc.ServerCall, index int64) (reply [10]string, err error) { |
| reply, err = __gen_s.service.KeyPage(call, index) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) Size(call _gen_ipc.ServerCall) (reply int64, err error) { |
| reply, err = __gen_s.service.Size(call) |
| return |
| } |
| |
| func (__gen_s *ServerStubCache) MultiGet(call _gen_ipc.ServerCall) (err error) { |
| stream := &implCacheServiceMultiGetStream{reader: implCacheServiceMultiGetStreamIterator{serverCall: call}, writer: implCacheServiceMultiGetStreamSender{serverCall: call}} |
| err = __gen_s.service.MultiGet(call, stream) |
| return |
| } |