Universal Binary Format 2.2 and Redis
Erlang Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Universal Binary Format and Redis

Copyright (c) 2012-2016 by Joseph Wayne Norton

Authors: Joseph Wayne Norton (norton@alum.mit.edu).

This is UBF-REDIS, a framework for integrating UBF and the Redis Unified Format (RUF) protocol. This repository depends on the ubf open source repository.

This repository is experimental in nature - use at your own risk and please contribute if you find UBF-REDIS useful.

Quick Start Recipe

To download, build, and test the ubf_redis application in one shot, please follow this recipe:

$ mkdir working-directory-name
$ cd working-directory-name
$ git clone https://github.com/ubf/ubf-redis.git ubf_redis
$ cd ubf_redis
$ make deps clean compile test


Where should I start?

This README is a good first step.

The UBF User's Guide is the best next step. Check out http://ubf.github.com/ubf/ubf-user-guide.en.html for further detailed information.

This repository has building blocks for constructing your own Redis server clone in Erlang.

  • src/ruf.erl Redis network protocol (a.k.a. RUF) encoder/decoder

  • src/ruf_term.erl Redis raw Erlang encoder/decoder

  • src/ubf_redis_types_plugin.erl Erlang types for Redis RPC

  • src/ubf_redis_plugin.erl Erlang Redis RPC request/response pairs

The QC (a.k.a. QuickCheck, PropEr, etc.) tests underneath the "tests/qc" directory should be helpful for understanding the specification and behavior of these building blocks.

  • test/qc/ruf_tests.erl prop_ruf_requests() tests encoding and decoding of RUF requests. Test inputs are automagically generated using the above Redis RPC types.This QC test has been completed.

  • test/qc/ruf_tests.erl prop_ruf_responses() tests encoding and decoding of RUF responses. Test inputs are automagically generated using the above Redis RPC types.This QC test has been completed.

  • test/qc/redis_proxy_tests.erl tests an Erlang Redis client talking with an Erlang Redis "Proxy" server. The Redis "Proxy" server forwards all requests transparently to a "real" Redis server (using another internal Erlang Redis client). All requests and responses sent to the Redis "Proxy" server are automagically generated and checked using UBF's contract manager with the above Redis RPC types and request/response pairs.This QC test is stil in-progress.

A few "hello world" Eunit tests can also be found in the test/eunit directory.

See below for further details on how to run these tests.

What is UBF?

UBF is the "Universal Binary Format", designed and implemented by Joe Armstrong. UBF is a language for transporting and describing complex data structures across a network. It has three components:

  • UBF(a) is a "language neutral" data transport format, roughly equivalent to well-formed XML.

  • UBF(b) is a programming language for describing types in UBF(a) and protocols between clients and servers. This layer is typically called the "protocol contract". UBF(b) is roughly equivalent to Verified XML, XML-schemas, SOAP and WDSL.

  • UBF(c) is a meta-level protocol used between a UBF client and a UBF server.

See http://ubf.github.com/ubf for further details.

What is Redis?

Redis is an open source, advanced key-value store. See http://redis.io for full details. In particular, see http://redis.io/topics/protocol for a description of the Redis protocol.


For further information and help for related tools, please refer to the following links:


  • Documentation

    • Explain overall implementation and test strategy.

    • Explain relevant UBF features.

    • Explain how one can start to build their own Redis server in Erlang.

  • Testing - Black Box

    • Implement real "statem" test model for the Redis Proxy.