server

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOffsetNotFound = fmt.Errorf("offset not found")

Functions

func NewGRPCServer added in v0.4.1

func NewGRPCServer(config *Config, grpcOpts ...grpc.ServerOption) (
	*grpc.Server,
	error,
)

NewGRPCServer provides a way to instantiate the service, create a gRPC server, and register the service with the server. This gives the user a server that just needs a listener.

func NewHTTPServer

func NewHTTPServer(addr string) *http.Server

Types

type Authorizer added in v0.5.2

type Authorizer interface {
	Authorize(subject, object, action string) error
}

Authorizer uses an interface to allow the service to use any authorization implementation, same as CommitLog

type CommitLog added in v0.4.1

type CommitLog interface {
	Append(*api.Record) (uint64, error)
	Read(uint64) (*api.Record, error)
}

CommitLog uses an interface to allow the service to use any log implementation that satisfies the log interface.

type Config added in v0.4.1

type Config struct {
	CommitLog  CommitLog
	Authorizer Authorizer
}

type ConsumeRequest

type ConsumeRequest struct {
	Offset uint64 `json:"offset"`
}

type ConsumeResponse

type ConsumeResponse struct {
	Record Record `json:"record"`
}

type Log

type Log struct {
	// contains filtered or unexported fields
}

func NewLog

func NewLog() *Log

func (*Log) Append

func (c *Log) Append(record Record) (uint64, error)

func (*Log) Read

func (c *Log) Read(offset uint64) (Record, error)

type ProduceRequest

type ProduceRequest struct {
	Record Record `json:"record"`
}

type ProduceResponse

type ProduceResponse struct {
	Offset uint64 `json:"offset"`
}

type Record

type Record struct {
	Value  []byte `json:"value"`
	Offset uint64 `json:"offset"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL