dicorn

package module
v0.0.0-...-93264bb Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2013 License: Apache-2.0 Imports: 11 Imported by: 0

README

dicorn

dicorn is a-sort-of translator which creates abstract interface on every database

memcache interface -----+                +-- leveldb backend
                        |                |
raw http interface -----+   +--------+   +-- Riak backend
                        +---+ dicorn +---+
cassandra interface ----+   +--------+   +-- spam backend
                        |                |
hbase interface --------+                +-- memory backend

Dunno all of this get success.

quickstart

Install Go . Clone this repo and build.

$ git clone git://github.com/kuenishi/dicorn
$ cd dicorn
$ go get
$ make

Riak client

Currently using riakpbc. Another option is goriakpbc .

bench

Micro benchmark on my MacBook Air

memcached

$ ./memcached
...
$ ./clients/memslap  --servers=localhost:11211 --non-blocking --concurrency=10
	Threads connecting to servers 10
	Took 1.987 seconds to load data

dicorn

$ ./dicorn -backend=mem -cmd=memcache -listen=localhost:11211
listening on localhost:11211
backend: mem
...
$ ./clients/memslap  --servers=localhost:11211 --non-blocking --concurrency=10
	Threads connecting to servers 10
	Took 2.705 seconds to load data

dicorn backed by Riak (single and local node)

$ ./dicorn -backend=riak -cmd=memcache -listen=localhost:11211    [master ~/src/dicorn]
2013/09/01 23:13:43 server.go:20: listening on localhost:11211
2013/09/01 23:13:43 server.go:21: backend: riak
2013/09/01 23:13:43 riak_backend.go:31: riak is ok: &{[localhost:8087] 0xf84005c680 <nil> false 1000}
...
$ ./clients/memslap  --servers=localhost:11211 --non-blocking --concurrency=10
	Threads connecting to servers 10
	Took 88.487 seconds to load data

Yay! So slow.

version

-200 million

author

2013, @kuenishi

license

Apache 2.0

Documentation

Index

Constants

View Source
const BUCKET = "fake_memcached"

Variables

This section is empty.

Functions

func Run

func Run(addr, backend_type, backend_hosts string)

func Version

func Version() string

Types

type Backend

type Backend interface {
	// so far interfaces for Memcached API
	Init()
	Set(string, int, int, int, []byte) error
	Get(key string) ([]byte, error)
	Delete(key string) error
	Incr(key string, valur int) (int, error)
	Decr(key string, valur int) (int, error)
}

type MemcacheAPI

type MemcacheAPI struct {
	Backend
}

func NewMemcacheAPI

func NewMemcacheAPI(backend, backend_hosts string) *MemcacheAPI

func (*MemcacheAPI) HandleBytes

func (m *MemcacheAPI) HandleBytes(buf []byte, conn net.Conn)

type MemoryBackend

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

func NewMemoryBackend

func NewMemoryBackend() *MemoryBackend

func (*MemoryBackend) Decr

func (mb *MemoryBackend) Decr(key string, value int) (int, error)

func (*MemoryBackend) Delete

func (mb *MemoryBackend) Delete(key string) error

func (*MemoryBackend) Get

func (mb *MemoryBackend) Get(key string) ([]byte, error)

func (*MemoryBackend) Incr

func (mb *MemoryBackend) Incr(key string, value int) (int, error)

func (*MemoryBackend) Init

func (mb *MemoryBackend) Init()

func (*MemoryBackend) Set

func (mb *MemoryBackend) Set(key string, flag, expire, size int, value []byte) error

type NotFoundError

type NotFoundError struct {
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type RiakBackend

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

func NewRiakBackend

func NewRiakBackend(hosts string) *RiakBackend

func (*RiakBackend) Decr

func (rb *RiakBackend) Decr(key string, value int) (int, error)

func (*RiakBackend) Delete

func (rb *RiakBackend) Delete(key string) error

func (*RiakBackend) Get

func (rb *RiakBackend) Get(key string) ([]byte, error)

func (*RiakBackend) Incr

func (rb *RiakBackend) Incr(key string, value int) (int, error)

func (*RiakBackend) Init

func (rb *RiakBackend) Init()

func (*RiakBackend) Set

func (rb *RiakBackend) Set(key string, flag, expire, size int, value []byte) error

type StorageInterface

type StorageInterface interface {
	HandleBytes(buf []byte, conn net.Conn)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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