Documentation ¶
Index ¶
- Variables
- func NewGRPCServer(config *Config, opts ...grpc.ServerOption) (*grpc.Server, error)
- func NewHTTPServer(addr string) *http.Server
- type Authorizer
- type CommitLog
- type Config
- type ConsumeRequest
- type ConsumeResponse
- type GetServerer
- type Log
- type ProduceRequest
- type ProduceResponse
- type Record
Constants ¶
This section is empty.
Variables ¶
var ErrOffsetNotFound = fmt.Errorf("offset not found")
ErrOffsetNotFound is an error returned if there are no records at the given offset.
Functions ¶
func NewGRPCServer ¶
NewGRPCServer creates a new gRPC server and registers the log server with it.
func NewHTTPServer ¶
NewHTTPServer takes in an address for the server to run on and returns a server handling POST and GET requests to root.
Types ¶
type Authorizer ¶
Authorizer holds authorization methods.
type Config ¶
type Config struct { CommitLog CommitLog Authorizer Authorizer GetServerer GetServerer }
Config holds configuration for the server.
type ConsumeRequest ¶
type ConsumeRequest struct {
Offset uint64 `json:"offset"`
}
ConsumeRequest holds the offset a requester wants to read logs from.
type ConsumeResponse ¶
type ConsumeResponse struct {
Record Record `json:"record"`
}
ConsumeResponse holds a record read from a Log.
type GetServerer ¶
GetServerer holds methods to expose available servers.
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log holds the records logged.
type ProduceRequest ¶
type ProduceRequest struct {
Record Record `json:"record"`
}
ProduceRequest contains the record that the requester wants to log.
type ProduceResponse ¶
type ProduceResponse struct {
Offset uint64 `json:"offset"`
}
ProduceResponse holds the offset an record was logged at.