ldbserver

package module
v0.0.0-...-515c297 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 19 Imported by: 0

README

ldbserver

standalone server for leveldb written in golang

Warning: this code is very experimental and is not ready for production use

Documentation

Overview

Package ldbserver is a generated protocol buffer package.

It is generated from these files:

transport.proto

It has these top-level messages:

TransportBody
TransportRequest
TransportResponse

Index

Constants

This section is empty.

Variables

View Source
var ErrStopped = errors.New("listener stopped")
View Source
var TransportRequest_Command_name = map[int32]string{
	0: "UNKNOWN",
	1: "GET",
	2: "PUT",
	3: "DELETE",
}
View Source
var TransportRequest_Command_value = map[string]int32{
	"UNKNOWN": 0,
	"GET":     1,
	"PUT":     2,
	"DELETE":  3,
}
View Source
var TransportResponse_Status_name = map[int32]string{
	0: "UNKNOWN",
	1: "OK",
	2: "FAIL",
}
View Source
var TransportResponse_Status_value = map[string]int32{
	"UNKNOWN": 0,
	"OK":      1,
	"FAIL":    2,
}

Functions

func CheckBody

func CheckBody(body *TransportBody) bool

func NewLevelDbServer

func NewLevelDbServer(dbname string) (s *leveldbServer, err error)

func SetBodyChecksum

func SetBodyChecksum(body *TransportBody)

Types

type DBServer

type DBServer interface {
	Close()
	// contains filtered or unexported methods
}

type DeadLineListener

type DeadLineListener interface {
	SetDeadline(t time.Time) (err error)
}

type JsonProtobufTransportFactory

type JsonProtobufTransportFactory struct{ Mt MarshalingType }

func (JsonProtobufTransportFactory) NewTransporter

func (f JsonProtobufTransportFactory) NewTransporter(r io.Reader, w io.Writer) Transporter

type MarshalingType

type MarshalingType int
const (
	MarshalingTypeJson MarshalingType = iota
	MarshalingTypeProtobuf
)

type NetworkServer

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

func NewNetworkServer

func NewNetworkServer(nName string, host string) *NetworkServer

func (*NetworkServer) ListenAndServe

func (serv *NetworkServer) ListenAndServe(db DBServer, tf TransporterFactory) error

func (*NetworkServer) Stop

func (serv *NetworkServer) Stop()

type TransportBody

type TransportBody struct {
	Checksum         *uint32 `protobuf:"varint,1,req,name=checksum" json:"checksum,omitempty"`
	Data             []byte  `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func NewPopulatedTransportBody

func NewPopulatedTransportBody(r randyTransport, easy bool) *TransportBody

func (*TransportBody) Equal

func (this *TransportBody) Equal(that interface{}) bool

func (*TransportBody) GetChecksum

func (m *TransportBody) GetChecksum() uint32

func (*TransportBody) GetData

func (m *TransportBody) GetData() []byte

func (*TransportBody) GoString

func (this *TransportBody) GoString() string

func (*TransportBody) Marshal

func (m *TransportBody) Marshal() (data []byte, err error)

func (*TransportBody) MarshalTo

func (m *TransportBody) MarshalTo(data []byte) (n int, err error)

func (*TransportBody) ProtoMessage

func (*TransportBody) ProtoMessage()

func (*TransportBody) Reset

func (m *TransportBody) Reset()

func (*TransportBody) Size

func (m *TransportBody) Size() (n int)

func (*TransportBody) String

func (m *TransportBody) String() string

func (*TransportBody) Unmarshal

func (m *TransportBody) Unmarshal(data []byte) error

func (*TransportBody) VerboseEqual

func (this *TransportBody) VerboseEqual(that interface{}) error

type TransportRequest

type TransportRequest struct {
	Id               []byte                    `protobuf:"bytes,1,req,name=id" json:"id,omitempty"`
	Command          *TransportRequest_Command `protobuf:"varint,2,req,name=command,enum=ldbserver.TransportRequest_Command" json:"command,omitempty"`
	Body             *TransportBody            `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"`
	XXX_unrecognized []byte                    `json:"-"`
}

func NewPopulatedTransportRequest

func NewPopulatedTransportRequest(r randyTransport, easy bool) *TransportRequest

func (*TransportRequest) Equal

func (this *TransportRequest) Equal(that interface{}) bool

func (*TransportRequest) GetBody

func (m *TransportRequest) GetBody() *TransportBody

func (*TransportRequest) GetCommand

func (*TransportRequest) GetId

func (m *TransportRequest) GetId() []byte

func (*TransportRequest) GoString

func (this *TransportRequest) GoString() string

func (*TransportRequest) Marshal

func (m *TransportRequest) Marshal() (data []byte, err error)

func (*TransportRequest) MarshalTo

func (m *TransportRequest) MarshalTo(data []byte) (n int, err error)

func (*TransportRequest) ProtoMessage

func (*TransportRequest) ProtoMessage()

func (*TransportRequest) Reset

func (m *TransportRequest) Reset()

func (*TransportRequest) Size

func (m *TransportRequest) Size() (n int)

func (*TransportRequest) String

func (m *TransportRequest) String() string

func (*TransportRequest) Unmarshal

func (m *TransportRequest) Unmarshal(data []byte) error

func (*TransportRequest) VerboseEqual

func (this *TransportRequest) VerboseEqual(that interface{}) error

type TransportRequest_Command

type TransportRequest_Command int32
const (
	TransportRequest_UNKNOWN TransportRequest_Command = 0
	TransportRequest_GET     TransportRequest_Command = 1
	TransportRequest_PUT     TransportRequest_Command = 2
	TransportRequest_DELETE  TransportRequest_Command = 3
)

func (TransportRequest_Command) Enum

func (TransportRequest_Command) String

func (x TransportRequest_Command) String() string

func (*TransportRequest_Command) UnmarshalJSON

func (x *TransportRequest_Command) UnmarshalJSON(data []byte) error

type TransportResponse

type TransportResponse struct {
	Id               []byte                    `protobuf:"bytes,1,req,name=id" json:"id,omitempty"`
	Status           *TransportResponse_Status `protobuf:"varint,2,req,name=status,enum=ldbserver.TransportResponse_Status" json:"status,omitempty"`
	Body             *TransportBody            `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"`
	XXX_unrecognized []byte                    `json:"-"`
}

func MakeErrorResponse

func MakeErrorResponse(code TransportResponse_Status, err error) *TransportResponse

func NewPopulatedTransportResponse

func NewPopulatedTransportResponse(r randyTransport, easy bool) *TransportResponse

func (*TransportResponse) Equal

func (this *TransportResponse) Equal(that interface{}) bool

func (*TransportResponse) GetBody

func (m *TransportResponse) GetBody() *TransportBody

func (*TransportResponse) GetId

func (m *TransportResponse) GetId() []byte

func (*TransportResponse) GetStatus

func (*TransportResponse) GoString

func (this *TransportResponse) GoString() string

func (*TransportResponse) Marshal

func (m *TransportResponse) Marshal() (data []byte, err error)

func (*TransportResponse) MarshalTo

func (m *TransportResponse) MarshalTo(data []byte) (n int, err error)

func (*TransportResponse) ProtoMessage

func (*TransportResponse) ProtoMessage()

func (*TransportResponse) Reset

func (m *TransportResponse) Reset()

func (*TransportResponse) Size

func (m *TransportResponse) Size() (n int)

func (*TransportResponse) String

func (m *TransportResponse) String() string

func (*TransportResponse) Unmarshal

func (m *TransportResponse) Unmarshal(data []byte) error

func (*TransportResponse) VerboseEqual

func (this *TransportResponse) VerboseEqual(that interface{}) error

type TransportResponse_Status

type TransportResponse_Status int32
const (
	TransportResponse_UNKNOWN TransportResponse_Status = 0
	TransportResponse_OK      TransportResponse_Status = 1
	TransportResponse_FAIL    TransportResponse_Status = 2
)

func (TransportResponse_Status) Enum

func (TransportResponse_Status) String

func (x TransportResponse_Status) String() string

func (*TransportResponse_Status) UnmarshalJSON

func (x *TransportResponse_Status) UnmarshalJSON(data []byte) error

type Transporter

type Transporter interface {
	GetRequest() (*TransportRequest, error)
	SendResponse(*TransportResponse) error
}

type TransporterFactory

type TransporterFactory interface {
	NewTransporter(r io.Reader, w io.Writer) Transporter
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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