eventsourcedb

package module
v0.0.0-...-39392a2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

README

EventSourceDB

What is it about?

This is a database to provide easy EventSourcing adoption at your organizarion, to safely store the source of truth about state of your application.

Status

ALPHA-GRADE SOFTWARE. NOT FOR PRODUCTION USE (YET).

Build Status

Features

  • JSON-enabled streaming HTTP2 API.
  • Pub/Sub.
  • Proxy-friendly.
  • Operations-friendly (backup, restore, scale as easy as adding new http proxies).
  • Uses Bolt as transactional, fast, and reliable storage.
  • Append-only workflow.
  • Yet it's possible to delete retired streams.

Install & Use

Build requirments:

Following command will install binaries into your $GOPATH/bin.

$ make deps install

Why HTTP2?

HTTP2 brings many advantages for such RPC-ish system, multiplexing multiple requests over a single TCP connection, flow control, header compression, binary encoding. Yet everyone are familiar with HTTP semantics.

Why not gRPC then?

To keep things simple. Simple requests, simple JSON, simple proxies. And to maintain some level of compatibility with HTTP1 clients (although, not recommended to use).

Client libraries

At the moment we don't have specific API client libraries but any HTTP2 library will work.

It's possible to use HTTP1 but highly not recommended, since it will introduce huge overhead on connections.

Roadmap

Our Roadmap

License

Apache 2.0

Copyright 2016 Artiom Diomin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

View Source
const (
	ErrCloseTimeout = Error("database close timeout")
	ErrDBClosed     = Error("database already closed")
)
View Source
const (
	ErrNoEventsData = Error("no events data")
	EOS             = Error("end of stream")
)
View Source
const (
	OurEpoch = 1455209242000 // OUR epoch starts from this millisecond since unix epoch

)

Variables

This section is empty.

Functions

func Routes

func Routes() http.Handler

Types

type BoltDB

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

func OpenBolt

func OpenBolt(fname string) (*BoltDB, error)

func (*BoltDB) Close

func (b *BoltDB) Close() error

func (*BoltDB) Fetch

func (b *BoltDB) Fetch(firstID, lastID uint64) (Cursor, error)

func (*BoltDB) Insert

func (b *BoltDB) Insert(events ...Event) (uint64, error)

type Cursor

type Cursor interface {
	Next() (Event, error)
}

type DB

type DB interface {
	Insert(events ...Event) (uint64, error)
	Fetch(firstID, lastID uint64) (Cursor, error)
	Close() error
}

type Env

type Env struct {
	DB *bolt.DB
}

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type Event

type Event struct {
	ID     uint64          `json:"id"`
	Stream string          `json:"stream"`
	Type   string          `json:"type"`
	Body   json.RawMessage `json:"body"`
}

func (*Event) MarshalJSON

func (mj *Event) MarshalJSON() ([]byte, error)

func (*Event) MarshalJSONBuf

func (mj *Event) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Event) UnmarshalJSON

func (uj *Event) UnmarshalJSON(input []byte) error

func (*Event) UnmarshalJSONFFLexer

func (uj *Event) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Hub

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

func NewHub

func NewHub(opts ...HubOpt) *Hub

func (*Hub) Cancel

func (h *Hub) Cancel(sub *Sub)

func (*Hub) Pub

func (h *Hub) Pub(evts ...Event) error

func (*Hub) Sub

func (h *Hub) Sub() *Sub

type HubOpt

type HubOpt func(*Hub)

type ID

type ID uint64

func New

func New(shardKey uint64) ID

type Sub

type Sub struct {
	Events chan uint64
	// contains filtered or unexported fields
}

func (*Sub) Next

func (s *Sub) Next() (Cursor, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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