server

package
v0.0.0-...-176aa4e Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 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, opts ...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
	GetServer  GetServerer
}

type ConsumeRequest

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

type ConsumeResponse

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

type GetServerer

type GetServerer interface {
	GetServers() ([]*api.Server, error)
}

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