Documentation ¶
Index ¶
- Constants
- func NewBatch(ctx context.Context, b Batching) ethdb.Batch
- func NewClientDatabase(ctx context.Context, cl *redis.Client) ethdb.Database
- func NewClusterDatabase(ctx context.Context, cl *redis.ClusterClient) ethdb.Database
- func NewDatabase(ctx context.Context, r Redis) ethdb.Database
- func NewIterator(ctx context.Context, prefix string, scanSize int64, it Iterating) ethdb.Iterator
- func NewRingDatabase(ctx context.Context, cl *redis.Ring) ethdb.Database
- type Batch
- type Batching
- type Database
- func (db *Database) Ancient(string, uint64) ([]byte, error)
- func (db *Database) AncientSize(string) (uint64, error)
- func (db *Database) Ancients() (uint64, error)
- func (db *Database) Close() error
- func (db *Database) Compact([]byte, []byte) error
- func (db *Database) Delete(key []byte) error
- func (db *Database) Get(key []byte) ([]byte, error)
- func (db *Database) Has(key []byte) (bool, error)
- func (db *Database) HasAncient(string, uint64) (bool, error)
- func (db *Database) ModifyAncients(func(ethdb.AncientWriteOp) error) (int64, error)
- func (db *Database) NewBatch() ethdb.Batch
- func (db *Database) NewIterator(prefix, _ []byte) ethdb.Iterator
- func (db *Database) Put(key, value []byte) error
- func (db *Database) ReadAncients(string, uint64, uint64, uint64) ([][]byte, error)
- func (db *Database) Stat(property string) (string, error)
- func (db *Database) Sync() error
- func (db *Database) TruncateAncients(uint64) error
- type Iterating
- type Iterator
- type Redis
- type Stat
Constants ¶
const ( /* Pool stats */ HITS = "Hits" MISSES = "Misses" TIMEOUTS = "Timeouts" TOTAL_CONNS = "TotalConns" IDLE_CONNS = "IdleConns" STABLE_CONNS = "StaleConns" /* Data stats */ DB_SIZE = "DbSize" /* Info stats */ SERVER_INFO = "Server" CLIENTS_INFO = "Clients" MEMORY_INFO = "Memory" PERSISTENCE_INFO = "Persistence" STATS_INFO = "Stats" REPLICATION_INFO = "Replication" CPU_INFO = "CPU" COMMAND_STATS_INFO = "Command" CLUSTER_INFO = "Cluster" MODULES_INFO = "Modules" KEYSPACE_INFO = "Keyspace" ERROR_STATS_INFO = "Errors" ALL_INFO = "All" DEFAULT_INFO = "Default" EVERYTHING = "Everything" )
Variables ¶
This section is empty.
Functions ¶
func NewClientDatabase ¶
NewClientDatabase creates a redis-ethdb using a Client
func NewClusterDatabase ¶
NewClusterDatabase creates a redis-ethdb using a ClusterClient
func NewDatabase ¶
NewDatabase creates a new Database
func NewIterator ¶
NewIterator creates a new Iterator
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch implements ethdb.Batch on top of Redis using pipelined transactions
func (Batch) Replay ¶
func (b Batch) Replay(w ethdb.KeyValueWriter) error
Replay satisfies ethdb.Batch
type Batching ¶
type Batching interface { Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd Del(ctx context.Context, keys ...string) *redis.IntCmd Discard() error Exec(ctx context.Context) ([]redis.Cmder, error) }
Batching redis interface required for supporting ethdb.Batch
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database implements ethdb.Database on top of Redis
func (*Database) AncientSize ¶
AncientSize satisfies ethdb.AncientReader
func (*Database) HasAncient ¶
HasAncient satisfies ethdb.AncientReader
func (*Database) ModifyAncients ¶
ModifyAncients satisfies ethdb.AncientWriter
func (*Database) NewIterator ¶
NewIterator satisfies ethdb.Iteratee Note: there is no practical way to have Redis begin iteration at an arbitrary "start" key, so this arg is discarded
func (*Database) ReadAncients ¶
ReadAncients satisfies ethdb.AncientReader
func (*Database) TruncateAncients ¶
TruncateAncients satisfies ethdb.AncientWriter
type Iterating ¶
type Iterating interface { Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd MGet(ctx context.Context, keys ...string) *redis.SliceCmd io.Closer }
Iterating redis interface required for supporting ethdb.Iterator
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator implements ethdb.Iterator on top of Redis using scans it is not safe for concurrent use, but multiple iterators can act concurrently on the same DB
type Redis ¶
type Redis interface { // Database interfaces Get(ctx context.Context, key string) *redis.StringCmd Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd Exists(ctx context.Context, keys ...string) *redis.IntCmd Del(ctx context.Context, keys ...string) *redis.IntCmd // Iterator interfaces Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd MGet(ctx context.Context, keys ...string) *redis.SliceCmd // Batch interfaces TxPipeline() redis.Pipeliner // Stats interfaces PoolStats() *redis.PoolStats DBSize(ctx context.Context) *redis.IntCmd Info(ctx context.Context, section ...string) *redis.StringCmd io.Closer }
Redis interface required for supporting ethdb interfaces