• Stars
    star
    193
  • Rank 194,893 (Top 4 %)
  • Language
    C
  • Created almost 9 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A distributed durable unique 64bit ID server

Distributed durable unique 64bit ID server

What?

ticketd is a distributed durable unique 64bit ID server. The raft protocol is used for consistency.

It uses LMDB for storing data, H2O for HTTP, and raft for concensus.

ticketd is completely written in C.

How?

ticketed opens 2 ports as follows:

  1. HTTP client traffic
  2. Peer to peer traffic using a ticketd specific binary protocol

Usage

Examples below make use of the excellent httpie

Starting

Node A starts a new cluster:

ticketd start --id 1 --raft_port 9001 --http_port 8001

Node B joins the new cluster via A:

ticketd join 127.0.0.1:9001 --id 2 --raft_port 9002 --http_port 8002

Node C joins the new cluster via A:

ticketd join 127.0.0.1:9001 --id 3 --raft_port 9003 --http_port 8003

Obtain a unique identifier via HTTP POST

http --ignore-stdin POST 127.0.0.1:8001
HTTP/1.1 200 OK
Connection: keep-alive
Date: Sat, 08 Aug 2015 10:02:07 GMT
Server: h2o/1.3.1
transfer-encoding: chunked

823378840

Leader Redirection

If we try to obtain an identifier from a non-leader, then ticketd will respond with a 301 redirect reponse. The redirect shows the location of the current leader.

Forcing the client to redirect to the leader means that future requests will be faster (ie. no delays are caused by proxying the request).

curl --request POST -i -L 127.0.0.1:8003
HTTP/1.1 301 Moved Permanently
Date: Thu, 13 Aug 2015 16:03:02 GMT
Server: h2o/1.3.1
Connection: close
location: http://127.0.0.1:8001/

HTTP/1.1 200 OK
Date: Thu, 13 Aug 2015 16:03:02 GMT
Server: h2o/1.3.1
Connection: keep-alive
transfer-encoding: chunked

1272863780

Leader Unavailability

If the leader isn't available, then we respond with a 503.

curl --request POST -i -L 127.0.0.1:8003
HTTP/1.1 503 Leader unavailable
Date: Sat, 15 Aug 2015 05:54:38 GMT
Server: h2o/1.3.1
Connection: keep-alive
content-length: 0

Building

$ make libuv
$ make libh2o
$ make

More Repositories

1

raft

C implementation of the Raft Consensus protocol, BSD licensed
C
1,090
star
2

cbuffer

A circular buffer written in C using Posix calls to create a contiguously mapped memory space. BSD Licensed.
C
248
star
3

pearldb

A Lightweight Durable HTTP Key-Value Pair Database in C
C
148
star
4

bipbuffer

A circular buffer alternative written in C under a BSD license
C
131
star
5

yabtorrent

Cross platform Bittorrent library written in C with a BSD license. Intended to be used as a framework for embedding bittorrent functionality
C
68
star
6

pytest-asyncio-cooperative

Run all your asynchronous tests cooperatively.
Python
68
star
7

heapless-bencode

Bencode reader library that doesn't use the heap. Written in C with a BSD license
C
49
star
8

heap

Heap priority queue written in C, licensed under a BSD license
C
31
star
9

bmon

Batch Monitor - Gain performance by combining work from multiple threads into a single batch
C
31
star
10

uv_multiplex

Take 1 TCP listen socket and duplicate it across N threads so you get some sweet multi-thread action happening
C
24
star
11

py2graphql

Python to GraphQL: A Pythonic GraphQL client
Python
20
star
12

array-avl-tree

An AVL tree implemented with an array, because cache misses keep you awake at night. Using a BSD license
C
18
star
13

duraqueue

Durable dead simple queue that allows zero copy semantics. Durable under failure!
C
18
star
14

linked-list-queue

A simple queue using a linked list written in C under the BSD license.
C
18
star
15

virtraft

Raft network simulator, for QA
C
16
star
16

splay-tree

A splaytree ADT written in C with a BSD license
C
16
star
17

skiplist

Dictionary implemented through a skiplist
C
15
star
18

bitfield

A bitfield ADT, used for easily managing bits, written in C under a BSD licence.
C
15
star
19

bitstream

A collection of functions for making writing to a bitstream eaisier; written in C under a BSD license
C
14
star
20

quadtree

A quadtree written in C. Perfect for culling things! BSD licensed
C
12
star
21

dogebox

C
11
star
22

arrayqueue

A queue implemented on an array, written in C using the BSD licence.
C
11
star
23

bag

Bag ADT written in C so that you can take randomly, licensed under a BSD license
C
11
star
24

meanqueue

A queue that calculates the running mean of its integer contents
C
11
star
25

pseudolru

A pseudo LRU cache written in C with a BSD license
C
10
star
26

streaming-bencode

Bencode reader that loves working with streams. Written in C with a BSD license
C
9
star
27

expboff

Simple function for doing exponential backoff in C
C
9
star
28

farraylist

An array list written in C that doesn't move objects once there is a "hole" between slots. BSD licensed.
C
8
star
29

texture-atlas

A simple texture atlas written in C. Graphics library agnostic. Under the BSD license
C
8
star
30

tearen

2D multi-platform OpenGL renderer written in C, licensed under the BSD license
C
7
star
31

taileff

tail -f for humans
Python
7
star
32

linked-list-hashmap

A hashmap which uses linked list nodes. Written in C and licensed under a BSD license
C
7
star
33

pidfile

Create a pidfile
C
6
star
34

torrent-reader

A simple torrent reader written in C under a BSD license
C
6
star
35

chunkybar

An ADT for accounting the status of a piece of data which can be progressed in "chunks" in any random order, written in C under a BSD licence.
C
6
star
36

pwp

A Bittorrent peer wire protocol implementation written in C under a BSD licence.
C
6
star
37

aqueue-noptr

An in-place queue implemented on an array, written in C using the BSD licence.
C
6
star
38

tracker-client

A simple Bittorrent tracker client, written in C under a BSD licence.
C
6
star
39

fe

Flip the endianess of integers
C
5
star
40

raft_amalgamation

Single file implementation of the Raft consensus protocol
C
5
star
41

defold-cognito

Objective-C
5
star
42

file2str

file2str simply reads a file and returns the contents as a null terminated string.
C
5
star
43

ds

ds is sudo alternative. Privileged commands execute once approved by other users.
Python
4
star
44

weak-reference-pool

An ADT and set of function calls that allow C programmers to make use of weak references; written in C under a BSD licence.
C
4
star
45

minmax

min and max functions for C
C++
4
star
46

yabtorrent-cli

Bittorrent client using the yabtorrent library
C
4
star
47

docopt2ragel

Define your CLI in docopt and output into a sweet C FSM using Ragel
Python
4
star
48

jz

Responsive JSON database presented as a REST server
Python
4
star
49

quadratic-probing-hashmap

C
3
star
50

comp-object

A framework for working with actors and composition in C
C
3
star
51

pip-versions

Get version information about a pip from pypi (and private repos)
Python
3
star
52

SDLProducerConsumerMonitor

A producer/consumer threading monitor; written in C under a BSD licence.
C
2
star
53

rsttst

rsttst makes your reStructuredText testable
Python
2
star
54

cutest

A simple TAP producing fork of the cutest C unit test framework.
C
2
star
55

SDLReadWriterMonitor

A read/writer threading monitoring for SDL; written in C under a BSD licence.
C
2
star
56

aiorelational

Async relational iterators/generators for manipulating data streams
Python
2
star
57

pyariable

Simplify your test assertions with placeholder variables
Python
2
star
58

chrootize

Automatically place a command's binary and libraries in a chroot jail. For OS/X.
Shell
1
star
59

dynamodb-pep249

PEP249 Database wrapper for DynamoDB
Python
1
star
60

config-re

A re-entrant safe fork of a config library
C
1
star
61

fff

Friendlier File Follower is a file alteration monitor that listens to as many files as possible while trying to play nice with the system's file watcher limits. Let's use libuv to keep it cross platform!
C
1
star
62

SDLIteratorMonitor

A threading monitor that allows iteration over an iterator; written in C under a BSD licence.
C
1
star
63

stubfile

A module for managing the creation of files where the content of the files will be written to randomly, written in C under a BSD licence.
C
1
star
64

Teeworlds-Fobik

A recreation of the Fobik Quake 3 mod for Teeworlds
1
star
65

event-timer

A event timer, written in C under a BSD licence.
C
1
star