docstore

package
v0.0.0-...-382cb39 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

README

storage of small data

Documentation

Index

Constants

View Source
const ErrBusinessRuleViolated = 20002 // `throw` in javascript code means business rule violation
View Source
const ErrDocumentSchemaViolated = 10004
View Source
const ErrDuplicatedEntity = LoggedErrStart // create entity with same entity id but with different command id
View Source
const ErrEntityMissing = 10006 // query can not find the entity
View Source
const ErrEventLogConflict = 10001 // the master is no longer in charge, should find out who is the master
View Source
const ErrForwardedTooManyTimes = 10002 // the master can not be found
View Source
const ErrMustCreateFirst = 20001 // entity not created yet, so can not exec other command
View Source
const ErrRequestSchemaViolated = 10003
View Source
const ErrResponseSchemaViolated = 10005
View Source
const ErrUnknown = 10000
View Source
const LoggedErrEnd = 30000
View Source
const LoggedErrStart = 20000

error number within range [LoggedErrStart, LoggedErrEnd) is committed in event_log as fact

Variables

This section is empty.

Functions

func AddEntity

func AddEntity(entityType string, schema *runtime.Schema) *entityTypeDef

func AddEventHandler

func AddEventHandler(handler EventHandler)

func Entity

func Entity(entityType string, thriftIDL string) *entityTypeDef

func StartNode

func StartNode(ctx context.Context, addr string)

func StopNode

func StopNode(ctx context.Context)

Types

type CommandHandler

type CommandHandler func(doc interface{}, request interface{}) (resp interface{})

type Event

type Event struct {
	PartitionId     uint64          `json:"-"`
	EntityType      string          `json:"-"`
	EventId         uint64          `json:"-"`
	EntityId        string          `json:"e"`
	BaseEventId     uint64          `json:"b"`
	Version         uint64          `json:"v"`
	CommandId       string          `json:"c"`
	CommandType     string          `json:"t"`
	CommandRequest  json.RawMessage `json:"r"`
	HandlerVersion  string          `json:"h"`
	CommandResponse json.RawMessage `json:"p"`
	State           json.RawMessage `json:"s"`
	Delta           json.RawMessage `json:"d"`
	CommittedAt     int64           `json:"a"`
}

type EventHandler

type EventHandler interface {
	LoadOffset(ctx context.Context, partitionId uint64, entityType string) (uint64, error)
	CommitOffset(ctx context.Context, partitionId uint64, entityType string, offset uint64) error
	Sync(ctx context.Context, event *Event) error
}

type NumberedError

type NumberedError interface {
	error
	ErrorNumber() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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