Documentation ¶
Overview ¶
Package pb is a generated protocol buffer package.
It is generated from these files:
service.proto
It has these top-level messages:
SubscribeJobRequest SubscribeJobResponse ReportJobRequest ReportJobResponse ReportJobDoneRequest ReportJobDoneResponse
Package pb is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.3.0.
It is generated from these files:
service.proto
Index ¶
- Constants
- Variables
- func WriteError(resp http.ResponseWriter, err error)
- type HTTPClient
- type Loom
- type ReportJobDoneRequest
- func (*ReportJobDoneRequest) Descriptor() ([]byte, []int)
- func (m *ReportJobDoneRequest) GetJobId() []byte
- func (m *ReportJobDoneRequest) GetTopicName() string
- func (m *ReportJobDoneRequest) GetWorkerId() string
- func (*ReportJobDoneRequest) ProtoMessage()
- func (m *ReportJobDoneRequest) Reset()
- func (m *ReportJobDoneRequest) String() string
- type ReportJobDoneResponse
- type ReportJobRequest
- func (*ReportJobRequest) Descriptor() ([]byte, []int)
- func (m *ReportJobRequest) GetJobId() []byte
- func (m *ReportJobRequest) GetJobMsg() []byte
- func (m *ReportJobRequest) GetTopicName() string
- func (m *ReportJobRequest) GetWorkerId() string
- func (*ReportJobRequest) ProtoMessage()
- func (m *ReportJobRequest) Reset()
- func (m *ReportJobRequest) String() string
- type ReportJobResponse
- type SubscribeJobRequest
- type SubscribeJobResponse
- func (*SubscribeJobResponse) Descriptor() ([]byte, []int)
- func (m *SubscribeJobResponse) GetJobId() []byte
- func (m *SubscribeJobResponse) GetJobMsg() []byte
- func (m *SubscribeJobResponse) GetJobStatus() SubscribeJobResponse_Status
- func (*SubscribeJobResponse) ProtoMessage()
- func (m *SubscribeJobResponse) Reset()
- func (m *SubscribeJobResponse) String() string
- type SubscribeJobResponse_Status
- type TwirpServer
Constants ¶
const LoomPathPrefix = "/twirp/loom.server.Loom/"
LoomPathPrefix is used for all URL paths on a twirp Loom server. Requests are always: POST LoomPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
Variables ¶
var SubscribeJobResponse_Status_name = map[int32]string{
0: "NoJob",
1: "NewJob",
}
var SubscribeJobResponse_Status_value = map[string]int32{
"NoJob": 0,
"NewJob": 1,
}
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 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 Loom ¶
type Loom interface { SubscribeJob(context.Context, *SubscribeJobRequest) (*SubscribeJobResponse, error) ReportJob(context.Context, *ReportJobRequest) (*ReportJobResponse, error) ReportJobDone(context.Context, *ReportJobDoneRequest) (*ReportJobDoneResponse, error) }
func NewLoomJSONClient ¶
func NewLoomJSONClient(addr string, client HTTPClient) Loom
NewLoomJSONClient creates a JSON client that implements the Loom interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewLoomProtobufClient ¶
func NewLoomProtobufClient(addr string, client HTTPClient) Loom
NewLoomProtobufClient creates a Protobuf client that implements the Loom interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type ReportJobDoneRequest ¶
type ReportJobDoneRequest struct { JobId []byte `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` WorkerId string `protobuf:"bytes,2,opt,name=worker_id,json=workerId" json:"worker_id,omitempty"` TopicName string `protobuf:"bytes,3,opt,name=topic_name,json=topicName" json:"topic_name,omitempty"` }
func (*ReportJobDoneRequest) Descriptor ¶
func (*ReportJobDoneRequest) Descriptor() ([]byte, []int)
func (*ReportJobDoneRequest) GetJobId ¶
func (m *ReportJobDoneRequest) GetJobId() []byte
func (*ReportJobDoneRequest) GetTopicName ¶
func (m *ReportJobDoneRequest) GetTopicName() string
func (*ReportJobDoneRequest) GetWorkerId ¶
func (m *ReportJobDoneRequest) GetWorkerId() string
func (*ReportJobDoneRequest) ProtoMessage ¶
func (*ReportJobDoneRequest) ProtoMessage()
func (*ReportJobDoneRequest) Reset ¶
func (m *ReportJobDoneRequest) Reset()
func (*ReportJobDoneRequest) String ¶
func (m *ReportJobDoneRequest) String() string
type ReportJobDoneResponse ¶
type ReportJobDoneResponse struct { }
func (*ReportJobDoneResponse) Descriptor ¶
func (*ReportJobDoneResponse) Descriptor() ([]byte, []int)
func (*ReportJobDoneResponse) ProtoMessage ¶
func (*ReportJobDoneResponse) ProtoMessage()
func (*ReportJobDoneResponse) Reset ¶
func (m *ReportJobDoneResponse) Reset()
func (*ReportJobDoneResponse) String ¶
func (m *ReportJobDoneResponse) String() string
type ReportJobRequest ¶
type ReportJobRequest struct { JobId []byte `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` WorkerId string `protobuf:"bytes,2,opt,name=worker_id,json=workerId" json:"worker_id,omitempty"` TopicName string `protobuf:"bytes,3,opt,name=topic_name,json=topicName" json:"topic_name,omitempty"` JobMsg []byte `protobuf:"bytes,4,opt,name=job_msg,json=jobMsg,proto3" json:"job_msg,omitempty"` }
func (*ReportJobRequest) Descriptor ¶
func (*ReportJobRequest) Descriptor() ([]byte, []int)
func (*ReportJobRequest) GetJobId ¶
func (m *ReportJobRequest) GetJobId() []byte
func (*ReportJobRequest) GetJobMsg ¶
func (m *ReportJobRequest) GetJobMsg() []byte
func (*ReportJobRequest) GetTopicName ¶
func (m *ReportJobRequest) GetTopicName() string
func (*ReportJobRequest) GetWorkerId ¶
func (m *ReportJobRequest) GetWorkerId() string
func (*ReportJobRequest) ProtoMessage ¶
func (*ReportJobRequest) ProtoMessage()
func (*ReportJobRequest) Reset ¶
func (m *ReportJobRequest) Reset()
func (*ReportJobRequest) String ¶
func (m *ReportJobRequest) String() string
type ReportJobResponse ¶
type ReportJobResponse struct { }
func (*ReportJobResponse) Descriptor ¶
func (*ReportJobResponse) Descriptor() ([]byte, []int)
func (*ReportJobResponse) ProtoMessage ¶
func (*ReportJobResponse) ProtoMessage()
func (*ReportJobResponse) Reset ¶
func (m *ReportJobResponse) Reset()
func (*ReportJobResponse) String ¶
func (m *ReportJobResponse) String() string
type SubscribeJobRequest ¶
type SubscribeJobRequest struct { WorkerId string `protobuf:"bytes,1,opt,name=worker_id,json=workerId" json:"worker_id,omitempty"` TopicName string `protobuf:"bytes,2,opt,name=topic_name,json=topicName" json:"topic_name,omitempty"` }
func (*SubscribeJobRequest) Descriptor ¶
func (*SubscribeJobRequest) Descriptor() ([]byte, []int)
func (*SubscribeJobRequest) GetTopicName ¶
func (m *SubscribeJobRequest) GetTopicName() string
func (*SubscribeJobRequest) GetWorkerId ¶
func (m *SubscribeJobRequest) GetWorkerId() string
func (*SubscribeJobRequest) ProtoMessage ¶
func (*SubscribeJobRequest) ProtoMessage()
func (*SubscribeJobRequest) Reset ¶
func (m *SubscribeJobRequest) Reset()
func (*SubscribeJobRequest) String ¶
func (m *SubscribeJobRequest) String() string
type SubscribeJobResponse ¶
type SubscribeJobResponse struct { JobId []byte `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"` JobMsg []byte `protobuf:"bytes,2,opt,name=job_msg,json=jobMsg,proto3" json:"job_msg,omitempty"` JobStatus SubscribeJobResponse_Status `` /* 127-byte string literal not displayed */ }
func (*SubscribeJobResponse) Descriptor ¶
func (*SubscribeJobResponse) Descriptor() ([]byte, []int)
func (*SubscribeJobResponse) GetJobId ¶
func (m *SubscribeJobResponse) GetJobId() []byte
func (*SubscribeJobResponse) GetJobMsg ¶
func (m *SubscribeJobResponse) GetJobMsg() []byte
func (*SubscribeJobResponse) GetJobStatus ¶
func (m *SubscribeJobResponse) GetJobStatus() SubscribeJobResponse_Status
func (*SubscribeJobResponse) ProtoMessage ¶
func (*SubscribeJobResponse) ProtoMessage()
func (*SubscribeJobResponse) Reset ¶
func (m *SubscribeJobResponse) Reset()
func (*SubscribeJobResponse) String ¶
func (m *SubscribeJobResponse) String() string
type SubscribeJobResponse_Status ¶
type SubscribeJobResponse_Status int32
const ( SubscribeJobResponse_NoJob SubscribeJobResponse_Status = 0 SubscribeJobResponse_NewJob SubscribeJobResponse_Status = 1 )
func (SubscribeJobResponse_Status) EnumDescriptor ¶
func (SubscribeJobResponse_Status) EnumDescriptor() ([]byte, []int)
func (SubscribeJobResponse_Status) String ¶
func (x SubscribeJobResponse_Status) String() string
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 NewLoomServer ¶
func NewLoomServer(svc Loom, hooks *twirp.ServerHooks) TwirpServer