jsr-server v0.1.100
Table of Contents
Server Module
Redis application server.
Component of the jsr library.
Install
npm i jsr-serverAPI
var Server = require('jsr-server')
, server = new Server();
server.load(function(err) {
if(err) throw err;
server.listen();
});The load method must be called to load the configuration file, command handlers and rdb file, once the load is complete you can call listen to bind to a port. If all your clients are within the same process and you do not want to bind to a port do not call listen.
See the tests for more code examples.
Options
The load method accepts an options object that supports all the options available to the conf module, loader module and adds the following options:
defaults: Include default commands when commands array is specified (boolean).
If no options are specified the behaviour is to load all the default commands and use the default configuration.
Defaults
When a commands array is specified (see the loader options) this flag will prepend the default commands directory to the commands array so that all the default commands will be loaded but may be overriden if necessary.
Status
Overview of the development status.
Connection
The connection command group (AUTH, PING etc) are implemented, tested and considered stable.
Pubsub
The pubsub command group (SUBSCRIBE, PUBLISH etc) are implemented, tested and considered stable.
Transaction
The transaction command group (MULTI, EXEC etc) are implemented, tested and considered stable.
Server
The server command group (BGSAVE, INFO etc) are implemented with the following exceptions:
CLIENT PAUSE: Implemented for TCP connections but not for in-process clients.CLIENT KILL: Does not accept filters, onlyhost:ipaddress at the moment.DEBUG [subcommand]: Not implemented.ROLE | SLAVEOF | SYNC: Not implemented.BGREWRITEAOF: Not implemented, no AOF support yet.CLUSTER SLOTS: Not implemented.
Key
The key command group (DEL, KEYS etc) are implemented and tested with the following exceptions:
RESTORE: Not implemented.MIGRATE: Not implemented.SORT: Not implemented.DUMP: Is implemented and produces output compatible with redis but has only currently been tested with thestringtype andRESTOREis not available so this is of limited use.
The OBJECT REFCOUNT command will always return -1 (or null if the key does not exist), possibly later a binding may be written that would allow us to determine how may references V8 holds to the object.
String
The database is able to transparently store values as string, number and Buffer instances.
The string command group (SET, SETNX, STRLEN etc.) are implemented, tested and considered stable.
Commands STRLEN | APPEND | SETRANGE return the byte length not the character length. When a value is a string and SETRANGE is called, the value is converted to a Buffer and modified before being stored again as a string so that zero padding works as expected for both the string and Buffer type.
Bitwise commands BITOP | BITPOS | BITCOUNT | GETBIT | SETBIT are not optimised and will be slow with large strings.
List
The list command group (LPUSH, LPOP etc) are implemented and tested with the following exceptions:
BLPOP | BRPOP | BRPOPLPUSH: Blocking list operations are not implemented.
Hash
The hash command group (HSET, HDEL etc) are implemented, tested and considered stable.
Set
The set command group (SADD, SMEMBERS etc) are implemented, tested and considered stable.
Sorted Set
Work in progress, not ready for use.
HyperLogLog
Not yet implemented.
Script
Experimental support for EVAL, EVALSHA and SCRIPT is available via the script module, see the documentation there for more information.
Persistence
The server is able to load and save rdb files which are compatible with redis but does not currently support snapshots (save configuration) and this feature should be considered experimental, in addition whilst rdb files written by the server can be loaded by redis they do not yet use smaller encoding such as the intset type etc. which means the files will be larger.
Inline Commands
The server supports inline commands so you can telnet to the server and execute commands, this is useful to see the RESP responses.
Start a server then connect to the default port using telnet:
telnet localhost 9736An example session:
dbsize
:0
set key value
+OK
dbsize
:1
get key
$5
value
del key
:1
dbsize
:0
quitYou can issue the monitor command in one telnet session and execute commands in another to see the server requests, an example monitor session:
monitor
+OK
+1419769792.368956 [0 127.0.0.1:59093] "dbsize"
+1419769797.264786 [0 127.0.0.1:59093] "set" "key" "value"
+1419769798.875027 [0 127.0.0.1:59093] "dbsize"
+1419769801.744245 [0 127.0.0.1:59093] "get" "key"
+1419769807.678000 [0 127.0.0.1:59093] "del" "key"
+1419769814.608361 [0 127.0.0.1:59093] "dbsize"
+1419769832.720229 [0 127.0.0.1:59095] "quit"Developer
Start
To start a server run:
node server.jsYou may specify the path to a configuration file to load and it will be used:
node server.js test/fixtures/debug.confAnd override configuration directives:
node server.js --daemonize yes --pidfile daemon.pid \
--loglevel warning --logfile daemon.logTest
Tests are not included in the package, clone the repository:
npm testDocumentation
To generate all documentation:
npm run docsReadme
To build the readme file from the partial definitions (requires mdp):
npm run readmeLicense
Everything is MIT. Read the license if you feel inclined.
Generated by mdp(1).
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago