tail

package module
v0.0.0-...-b63c749 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 12 Imported by: 0

README

Tail

a remote sorted value store

Tail is a service with a level DB in the heart that is accessible with HTTP(S) for web browsers and UDP for faster access; you can insert any value into the Tail and retrieve them sorted. insertion: a client can insert a value into the Tail with an HTTP request that body is as the value or a UDP packet that whole of the packet is as value. Tail receives values and inserts them into level DB that the key of the key-value pair is the whole of the packet, and the value is some metadata like the insertion time. that means Tail has no duplicate value while keeping them sorted. after insertion, Tail returns the next available value is placed right after in the sorted list into the HTTP response body or as a UDP packet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = leveldb.ErrNotFound

Functions

func Push

func Push(addr string, b []byte) error

Types

type Core

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

func NewCore

func NewCore(storage *Storage) *Core

func (*Core) Clean

func (core *Core) Clean(before time.Time) (int, error)

func (*Core) Get

func (core *Core) Get(last []byte) ([]byte, error)

func (*Core) Put

func (core *Core) Put(b []byte, time time.Time) error

type Poller

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

func NewPoller

func NewPoller(addr string) (*Poller, error)

func (*Poller) Close

func (poller *Poller) Close() error

func (*Poller) Poll

func (poller *Poller) Poll(last []byte, addr net.Addr) ([]byte, error)

type Server

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

func NewServer

func NewServer(ctx context.Context, core *Core) *Server

func (*Server) Close

func (server *Server) Close() error

func (*Server) Listen

func (server *Server) Listen(addr string) error

type Storage

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

func OpenStorage

func OpenStorage(path string) (storage *Storage, err error)

func (*Storage) Close

func (storage *Storage) Close() error

func (*Storage) Fold

func (storage *Storage) Fold(start, end []byte, forEach func(key, val []byte) error) error

func (*Storage) Get

func (storage *Storage) Get(start []byte) (key, val []byte, err error)

func (*Storage) Purge

func (storage *Storage) Purge(key []byte) error

func (*Storage) Put

func (storage *Storage) Put(key []byte, val []byte) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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