store

package
v0.0.0-...-705e2cb Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 0 Imported by: 4

README

Store

Storage layer of redis framework, this will give MrRedis the ability to remember things permanently.

There are two types of objects this framework will persist.

  • (Redis) Proc
  • (Redis) Service Instance
Redis Proc

A redis-server process running in any of the mesos-slave is called a Redis Proc (Redis Process).

A Redis Proc has the following properties

  • In the datacenter each Proc is identified by a UID
  • It belongs to a Service Instance
  • It binds to a particular port
  • It can either be a Redis Master or a Redis Slave
  • It has a PID
  • It is monitored by Redis Monitor (REDMON)
  • REDMON updates the statistically information about this PROC periodically
Redis Service Instance

A logical representation of the service instance that encapsulates one or more Redis Proc

A Service Instance can be of the following type

  • Single Instance: Contains one redis Proc exposes an IP/Port
  • Master-Slave: Contains one Proc as master and rest of the redis Procs as slaves
  • Cluster: Future Work when support of Redis 3.0 Cluster is added

This is identical to POD terminology in K8s, we could group one or more Procs as one unit, they are created and monitored together.

PS: For convenience we will loose the obvious prefix 'Redis' and simple call Service Instance and Proc in the rest of the project

Considerations

It has been decided to use etcd as data store backend initially. More support of other DB to be added later.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {

	//Perform the initial setup of the database/KV store by creating DB/Namespace etc that are important for running MrRedis
	Setup(config string) error

	//Check if the database is setup already or not for Redis Framework
	IsSetup() bool

	//Optionally used if the db provides any auth mechanism perform that will handle DB apis like Connect/Login/Authorize etc.,
	Login() error

	//Set the value for the Key , if the key does not exist create one (Will be an Insert if we RDBMS is introduced)
	Set(Key string, Value string) error

	//Does this key exist in the db already
	IsKey(Key string) (bool, error)

	//Update a particular Key with the value only if the key is valid already, optionally try to lock the key as well (Update in RDBMS)
	Update(Key string, Value string, Lock bool) error

	//Get the value for a particular key (Will be a Select for RDBMS)
	Get(Key string) (string, error)

	//Delete a particular key from the store (Will be DEL for RDBMS)
	Del(Key string) error

	//Section
	//Section is a DIR in etcd
	//Section will be a namespace in Redis
	//Section will be a Table in RDBMS
	//Create Section
	CreateSection(Key string) error

	//Delete Section
	DeleteSection(Key string) error

	//List the complete secton if recursive then list the entirer directory tree, only the key not the value
	ListSection(Key string, Recursive bool) ([]string, error)

	//Completly wipe out the DB/KV store about all the information pertaining to MrRedis
	CleanSlate() error
}

DB Interface that every DB pkg must comply for MrRedis

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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