bitmapist

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package bitmapist implements standalone bitmapist server that can be used instead of Redis for https://github.com/Doist/bitmapist library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

Logger is a set of methods used to log information. *log.Logger implements this interface.

type Server

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

Server is a standalone bitmapist server implementation. It's intended to be run on top of github.com/artyom/red.Server which handles redis protocol-level details and networking.

func New

func New(dbFile string) (*Server, error)

New returns initialized Server that loads/saves its data in dbFile

func (*Server) Backup

func (s *Server) Backup(w io.Writer) error

Backup writes current on-disk saved database to Writer w. It's not safe to copy database file while it's used, so this method can be used to get a consistent copy of database.

func (*Server) Register

func (s *Server) Register(srv *red.Server)

Register registers supported command handlers on provided srv

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown performs saves current state on disk and closes database. Shutdown blocks until state is saved and database is closed. Server should not be used afterwards.

func (*Server) WithLogger

func (s *Server) WithLogger(l Logger)

WithLogger configures server to use provided Logger.

Jump to

Keyboard shortcuts

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