Documentation
¶
Overview ¶
Package shard is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.4.2.
It is generated from these files:
shard.proto
Index ¶
- Constants
- func WriteError(resp http.ResponseWriter, err error)
- type GeneralRequest
- func (*GeneralRequest) Descriptor() ([]byte, []int)
- func (m *GeneralRequest) GetAddress() string
- func (m *GeneralRequest) GetAddresses() []string
- func (m *GeneralRequest) GetBytes() []byte
- func (m *GeneralRequest) GetExponent() uint32
- func (m *GeneralRequest) GetIsBootstrap() bool
- func (m *GeneralRequest) GetNetworkName() string
- func (m *GeneralRequest) GetPath() string
- func (m *GeneralRequest) GetPort() uint32
- func (*GeneralRequest) ProtoMessage()
- func (m *GeneralRequest) Reset()
- func (m *GeneralRequest) String() string
- func (m *GeneralRequest) XXX_DiscardUnknown()
- func (m *GeneralRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GeneralRequest) XXX_Merge(src proto.Message)
- func (m *GeneralRequest) XXX_Size() int
- func (m *GeneralRequest) XXX_Unmarshal(b []byte) error
- type GeneralResponse
- func (*GeneralResponse) Descriptor() ([]byte, []int)
- func (m *GeneralResponse) GetMessage() string
- func (*GeneralResponse) ProtoMessage()
- func (m *GeneralResponse) Reset()
- func (m *GeneralResponse) String() string
- func (m *GeneralResponse) XXX_DiscardUnknown()
- func (m *GeneralResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GeneralResponse) XXX_Merge(src proto.Message)
- func (m *GeneralResponse) XXX_Size() int
- func (m *GeneralResponse) XXX_Unmarshal(b []byte) error
- type HTTPClient
- type Shard
- type TwirpServer
Constants ¶
const ShardPathPrefix = "/twirp/shard.Shard/"
ShardPathPrefix is used for all URL paths on a twirp Shard server. Requests are always: POST ShardPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type GeneralRequest ¶
type GeneralRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Addresses []string `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` IsBootstrap bool `protobuf:"varint,3,opt,name=isBootstrap,proto3" json:"isBootstrap,omitempty"` Port uint32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` Exponent uint32 `protobuf:"varint,5,opt,name=exponent,proto3" json:"exponent,omitempty"` Path string `protobuf:"bytes,6,opt,name=path,proto3" json:"path,omitempty"` Bytes []byte `protobuf:"bytes,7,opt,name=bytes,proto3" json:"bytes,omitempty"` NetworkName string `protobuf:"bytes,8,opt,name=networkName,proto3" json:"networkName,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GeneralRequest) Descriptor ¶
func (*GeneralRequest) Descriptor() ([]byte, []int)
func (*GeneralRequest) GetAddress ¶
func (m *GeneralRequest) GetAddress() string
func (*GeneralRequest) GetAddresses ¶
func (m *GeneralRequest) GetAddresses() []string
func (*GeneralRequest) GetBytes ¶
func (m *GeneralRequest) GetBytes() []byte
func (*GeneralRequest) GetExponent ¶
func (m *GeneralRequest) GetExponent() uint32
func (*GeneralRequest) GetIsBootstrap ¶
func (m *GeneralRequest) GetIsBootstrap() bool
func (*GeneralRequest) GetNetworkName ¶
func (m *GeneralRequest) GetNetworkName() string
func (*GeneralRequest) GetPath ¶
func (m *GeneralRequest) GetPath() string
func (*GeneralRequest) GetPort ¶
func (m *GeneralRequest) GetPort() uint32
func (*GeneralRequest) ProtoMessage ¶
func (*GeneralRequest) ProtoMessage()
func (*GeneralRequest) Reset ¶
func (m *GeneralRequest) Reset()
func (*GeneralRequest) String ¶
func (m *GeneralRequest) String() string
func (*GeneralRequest) XXX_DiscardUnknown ¶
func (m *GeneralRequest) XXX_DiscardUnknown()
func (*GeneralRequest) XXX_Marshal ¶
func (m *GeneralRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GeneralRequest) XXX_Merge ¶
func (m *GeneralRequest) XXX_Merge(src proto.Message)
func (*GeneralRequest) XXX_Size ¶
func (m *GeneralRequest) XXX_Size() int
func (*GeneralRequest) XXX_Unmarshal ¶
func (m *GeneralRequest) XXX_Unmarshal(b []byte) error
type GeneralResponse ¶
type GeneralResponse struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*GeneralResponse) Descriptor ¶
func (*GeneralResponse) Descriptor() ([]byte, []int)
func (*GeneralResponse) GetMessage ¶
func (m *GeneralResponse) GetMessage() string
func (*GeneralResponse) ProtoMessage ¶
func (*GeneralResponse) ProtoMessage()
func (*GeneralResponse) Reset ¶
func (m *GeneralResponse) Reset()
func (*GeneralResponse) String ¶
func (m *GeneralResponse) String() string
func (*GeneralResponse) XXX_DiscardUnknown ¶
func (m *GeneralResponse) XXX_DiscardUnknown()
func (*GeneralResponse) XXX_Marshal ¶
func (m *GeneralResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GeneralResponse) XXX_Merge ¶
func (m *GeneralResponse) XXX_Merge(src proto.Message)
func (*GeneralResponse) XXX_Size ¶
func (m *GeneralResponse) XXX_Size() int
func (*GeneralResponse) XXX_Unmarshal ¶
func (m *GeneralResponse) XXX_Unmarshal(b []byte) error
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.
type Shard ¶
type Shard interface { NewShard(context.Context, *GeneralRequest) (*GeneralResponse, error) NewShardWithNodes(context.Context, *GeneralRequest) (*GeneralResponse, error) Shard(context.Context, *GeneralRequest) (*GeneralResponse, error) QueryForAddress(context.Context, *GeneralRequest) (*GeneralResponse, error) LogShard(context.Context, *GeneralRequest) (*GeneralResponse, error) CalculateQuadraticExponent(context.Context, *GeneralRequest) (*GeneralResponse, error) }
func NewShardJSONClient ¶
func NewShardJSONClient(addr string, client HTTPClient) Shard
NewShardJSONClient creates a JSON client that implements the Shard interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewShardProtobufClient ¶
func NewShardProtobufClient(addr string, client HTTPClient) Shard
NewShardProtobufClient creates a Protobuf client that implements the Shard interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type TwirpServer ¶
type TwirpServer interface { http.Handler // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a // github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a // low-level field, expected to be used for reflection. ServiceDescriptor() ([]byte, int) // ProtocGenTwirpVersion is the semantic version string of the version of // twirp used to generate this file. ProtocGenTwirpVersion() string }
TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.
func NewShardServer ¶
func NewShardServer(svc Shard, hooks *twirp.ServerHooks) TwirpServer