server

package
v0.0.0-...-7918ae8 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func NewGRPCServer

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

func NewHTTPServer

func NewHTTPServer(addr string) *http.Server

Types

type Authorizer

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

type CommitLog

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

type Config

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