forked from dengwh0523/yxtrang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
135 lines (76 loc) · 3.04 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Yxtrang
-------
The 'trang is not a framework, it's a library. A toolkit. A loose
collection of small modules that do interesting things and which can
be used together if need be or not. It has no dependencies on any
external libraries. It is written in plain old C and is absolutely
free, with a BSD 2-clause license.
I've enjoyed rewriting code that I previously did in C++, and for
the most part it's cleaner, more concise, easier to understand and
faster.
From little things big things grow!
Current modules
---------------
base64:
Base64 encoder/decoder.
daemon:
Platform agnostic daemonizer code.
httpserver:
Mechanism to easily write a custom HTTP handler (see examples/httpd).
Should also serve as a template for any bespoke protocol.
json:
JSON parser/generator.
jsonq:
JSON quick and dirty search for named value. Doesn't allocate any
memory and is useful for one-off key-value fetches.
linda:
An implementation of the Linda coordination language as an idempotent
JSON database built on top of 'store'. It has some limited indexing
and ad-hoc querying capabilities (see examples/lindad).
list:
Simple doubly-linked list/stack operations.
network:
Threadpooled socket handling with support for select, poll, epoll
and kqueue. Supports TCP (with TLS) and UDP (unicast, multicast and
broadcast).
scriptlet:
Engine to compile to bytecode and run micro-scripts. These can be used
for event-handling/event-processing to transform input under user
defined rules that are loaded at run-time.
skipbuck:
Skiplist buckets. This unique variant of a skiplist uses a bucketized
mod allowing more efficient storage (eg. 400M vs 150M keys on an 8GB
system) than the original skiplist code (see below).
skiplist:
A simple dictionary based on a skiplist. Optionally allow duplicates.
Only the key/value pointers are stored, no data is copied, but the
option exists to free keys and/or values if needed.
store:
Append-mode log-structured store with index by UUID. There is no
persistent disk index, rather it is regenerated in memory each time
at start.
thread:
Threads, threadpool, locks, atomics etc.
tree:
Append-mode binary tree designed primarily for in-order (or near)
insertion. Delete is supported with space recovery. This variant is
bucketized and is extremely space-efficient: equal to skipbuck above
but twice as fast.
uncle:
Umbilical network client liason engine. Resource discovery. Uses UDP
(broadcast for now, will move to multicast) datagrams. Uncle is scope
based, meaning it can organize resources by group: those within the
same scope can find each other, but not those outside. Uncle is not
a centralized server. It's job is to facilitate decentralized and
distributed services via mutual discovery.
uuid:
Universal unique identifiers.
Build
-----
git clone http://github.com/infradig/yxtrang
cd yxtrang
make
There are no outside code dependencies other than OpenSSL.
Compilers tested: gcc & clang with C99 and C11 options.
Also tcc and VC++2010.
Platforms tested: Linux, FreeBSD, WinXP, Win7+.