Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go Frontend #130

Merged
merged 46 commits into from
Nov 26, 2014
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
34a860e
Get rid of the Erlang frontend
Hamcha Sep 19, 2014
a6e7067
Semiworking server (from goleg/d projects)
Hamcha Sep 19, 2014
a6920a3
Updated README
Hamcha Sep 20, 2014
88af29c
More detailed CONTRIBUTING.md
Hamcha Sep 20, 2014
fda97c5
Big refactor of Golegd to be better organized
Hamcha Sep 21, 2014
f630f32
Add F_AOL_FFLUSH to fix hippie filesystems
Hamcha Sep 21, 2014
32c5708
Close all databases before closing
Hamcha Sep 21, 2014
7dca943
Experimental PrefixMatch function (aka Won't work)
Hamcha Sep 21, 2014
03579f0
Added golang installs for testing go-frontend
kyleterry Sep 21, 2014
4c10ef2
Added cd to frontend
kyleterry Sep 21, 2014
8c08dc2
Trying this?
kyleterry Sep 21, 2014
fddf17e
fuck a cd
kyleterry Sep 21, 2014
6b96c32
Replacing instances of erlang with Go
kyleterry Sep 24, 2014
3e050e9
Consistent imports
kyleterry Sep 24, 2014
ef54951
Prefix matching on frontend
Hamcha Sep 26, 2014
68967e6
Include/lib dirs fixed, Prefix matching changed
Hamcha Sep 26, 2014
fcd2b49
Merge latest changes in master (Prefix helpers)
Hamcha Sep 28, 2014
4b21c97
Preliminary cursor functions (not finished)
Hamcha Sep 28, 2014
6d6ed73
Cursor operations are a-go!
Hamcha Sep 28, 2014
1407b9f
Typo!
Hamcha Sep 28, 2014
0f7db08
Setup for tests
Hamcha Sep 28, 2014
2ababa0
Harcoded old test directory begone
Hamcha Sep 28, 2014
2ac3071
Modified documentation to reflect frontend changes
Hamcha Sep 28, 2014
3f04060
Fix bug in prefix matching api
Hamcha Sep 28, 2014
7007add
Merge branch 'feature/go-frontend' of ssh://github.com/infoforcefeed/…
Hamcha Sep 28, 2014
349d3bb
Fix compilation issue the ugly way
Hamcha Sep 28, 2014
80544a1
Fix potential sigsegv caught by Clang 3.3
Hamcha Sep 28, 2014
a603f16
Couple more tests
Hamcha Oct 7, 2014
e33f4ca
Cleaner errors, still needs some work
kyleterry Nov 9, 2014
ec8cbaa
Lock because oleg is like that
kyleterry Nov 9, 2014
116765c
Added data dir to .gitignore
kyleterry Nov 9, 2014
21f7391
Couple of fixes. Q can fix the rest
kyleterry Nov 9, 2014
d62d926
Stray erlang words
kyleterry Nov 10, 2014
c933583
Merge branch 'master' into feature/go-frontend
kyleterry Nov 25, 2014
7873e1c
Git leaving messes behind
kyleterry Nov 25, 2014
08d1461
Compiles, but still can't find liboleg
kyleterry Nov 25, 2014
114e016
More json-esk
kyleterry Nov 25, 2014
c3e5840
Fixed some tests
kyleterry Nov 25, 2014
30936fc
oops, this passes now
kyleterry Nov 26, 2014
969fdd6
We only need a few samples since oleg backend covers most of this
kyleterry Nov 26, 2014
0a93303
Hopefully this hack heals travis
kyleterry Nov 26, 2014
1d6430f
sudo
kyleterry Nov 26, 2014
a8665df
I'm despirate
kyleterry Nov 26, 2014
c0379dc
Makefile actually works now.
qpfiffer Nov 26, 2014
45cd984
I think this fixes the linker bugs.
qpfiffer Nov 26, 2014
99f7018
Cleaned up logging and config example
kyleterry Nov 25, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
language: c
compiler:
- gcc
- clang
script: make liboleg oleg_test && export LD_LIBRARY_PATH=./build/lib:$LD_LIBRARY_PATH && ./build/bin/oleg_test
- gcc
- clang
script:
- make liboleg oleg_test
- export LD_LIBRARY_PATH=./build/lib:$LD_LIBRARY_PATH
- ./build/bin/oleg_test
- go test ./...
before_install:
- sudo apt-get update
- sudo apt-get install golang
notifications:
email:
on_success: never
on_failure: change
recipients:
- "[email protected]"
on_success: never
on_failure: change
recipients:
- "[email protected]"
env:
global:
- secure: "GbSMNCqnGnjiuDqJJ55/EaNifx9L7t6JQVPw6illEnGZXL3T5RiC7alrpOQl2qGJG/gwRudMpFmEyvEqs0Rlpgx3x1DvcLCMlC2Rjd/2YklD0KVW0D91Mrrkk7ERzQTO8MXB2AUTxjSAwsZtewybebQhoqr7frulM4TclDZ/Cq4="
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,23 @@ with this one.
ol_bucket *c, *v, *u, *zx;
````
We're probably not going to accept that pull request.
* No tabs, just spaces
* All the above applies for the C code, for the Go frontend we use `gofmt` rules (default settings)

Architecture Decisions
----------------------

Communication is key. If you're making a rather big architecture decision,
discuss it with others. A second pair of eyes often does wonders to reveal weird
or bad ideas.
or bad ideas.
If you don't feel like making an issue or want quick feedback on it, hit us on [IRC](https://olegdb.org/community.html#irc), we do most of our discussions in there.

Code Review
-----------

All code should be code-reviewed by at least one other person before being
merged into master. Master is considered stable and should always pass tests.
Ping @qpfiffer for quick commentary.
Ping [@qpfiffer](github.com/qpfiffer) for quick commentary.

Documentation
-------------
Expand Down
53 changes: 11 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@ ifndef CC
endif
VERSION=0.1.5
SOVERSION=0
BUILD_DIR=$(shell pwd)/build/
CUR_DIR=$(shell pwd)
BUILD_DIR=$(CUR_DIR)/build/
LIB_DIR=$(BUILD_DIR)lib/
BIN_DIR=$(BUILD_DIR)bin/
PREFIX?=/usr/local
INSTALL_LIB=$(PREFIX)/lib/
INSTALL_BIN=$(PREFIX)/bin/
INSTALL_INCLUDE=$(PREFIX)/include/olegdb/
export CGO_LDFLAGS=-L$(BUILD_DIR)lib

ERL_LIB_LOOKFOR=-DLIBLOCATION=\"./build/lib/\"
ERLFLAGS=-smp -W1 -Werror -b beam -I./include -o $(BIN_DIR) $(ERL_LIB_LOOKFOR)
ERL_DIR=$(shell echo 'io:format("~s~n",[code:root_dir()]),init:stop().' | erl | sed -n '/^1>/s/^1> //p')
ERLI_DIR=$(shell echo 'io:format("~s~n",[code:lib_dir(erl_interface)]),init:stop().' | erl | sed -n '/^1>/s/^1> //p')
ERLINCLUDES=-I$(ERL_DIR)/usr/include/ -I$(ERLI_DIR)/include/
ERLLIBS=-L$(ERL_DIR)/usr/lib/ -L$(ERLI_DIR)/lib/
ERL_ODB_INSTALL_DIR=$(ERL_DIR)/lib/olegdb-$(VERSION)
INCLUDES=-I./include

MATH_LINKER=
Expand All @@ -36,20 +31,11 @@ test.o: ./c_src/test.c
main.o: ./c_src/main.c
$(CC) $(CFLAGS) $(INCLUDES) -c $<

port_driver.o: ./c_src/port_driver.c
$(CC) $(CFLAGS) $(INCLUDES) $(ERLINCLUDES) -c $< -fpic

%.o: ./c_src/%.c
$(CC) $(CFLAGS) $(INCLUDES) -c -fPIC $<

FORCE:

$(BIN_DIR)ol_database.beam: ./src/ol_database.erl FORCE
erlc $(ERLFLAGS) $<

$(BIN_DIR)%.beam: ./src/%.erl
erlc $(ERLFLAGS) $<

oleg_test: $(BIN_DIR)oleg_test
$(BIN_DIR)oleg_test: liboleg test.o main.o
$(CC) $(CFLAGS) $(INCLUDES) -L$(LIB_DIR) -o $(BIN_DIR)oleg_test test.o main.o $(MATH_LINKER) -loleg
Expand All @@ -58,34 +44,17 @@ liboleg: $(LIB_DIR)liboleg.so
$(LIB_DIR)liboleg.so: murmur3.o oleg.o logging.o aol.o rehash.o file.o utils.o tree.o lz4.o stack.o cursor.o data.o
$(CC) $(CFLAGS) $(INCLUDES) -o $(LIB_DIR)liboleg.so $^ -fpic -shared $(MATH_LINKER)

server: $(BIN_DIR)ol_database.beam $(BIN_DIR)ol_http.beam \
$(BIN_DIR)ol_parse.beam $(BIN_DIR)ol_util.beam $(BIN_DIR)olegdb.beam \
$(BIN_DIR)ol_route.beam $(LIB_DIR)liboleg.so port_driver.o
$(CC) $(CFLAGS) $(INCLUDES) $(ERLINCLUDES) $(ERLLIBS) -L$(LIB_DIR) -o $(LIB_DIR)libolegserver.so port_driver.o -fpic -shared $(MATH_LINKER) -loleg -lei

uninstall:
rm -rf $(INSTALL_LIB)/liboleg*
rm -rf $(INSTALL_BIN)/olegdb
rm -rf $(ERL_ODB_INSTALL_DIR)
rm -rf $(INSTALL_LIB)liboleg*
rm -rf $(INSTALL_BIN)olegdb

server: liboleg
go build -o $(BIN_DIR)olegdb ./frontend

install: erlinstall
install: goinstall

# The reason we have install twice here is because the variable needs to be compiled install
# when we are installing. It tells erlang where to look
erlinstall: ERL_LIB_LOOKFOR=-DLIBLOCATION=\"$(INSTALL_LIB)\"
erlinstall: libinstall server
@mkdir -p $(INSTALL_BIN)
install $(LIB_DIR)libolegserver.so $(INSTALL_LIB)libolegserver.so.$(VERSION)
ln -fs $(INSTALL_LIB)libolegserver.so.$(VERSION) $(INSTALL_LIB)libolegserver.so
ln -fs $(INSTALL_LIB)libolegserver.so.$(VERSION) $(INSTALL_LIB)libolegserver.so.$(SOVERSION)
@mkdir -p $(ERL_ODB_INSTALL_DIR)/src
@mkdir -p $(ERL_ODB_INSTALL_DIR)/include
@mkdir -p $(ERL_ODB_INSTALL_DIR)/ebin
install $(BIN_DIR)*.beam $(ERL_ODB_INSTALL_DIR)/ebin
install ./include/*.hrl $(ERL_ODB_INSTALL_DIR)/include
install ./src/*.erl $(ERL_ODB_INSTALL_DIR)/src
install ./src/*.app.src $(ERL_ODB_INSTALL_DIR)/ebin
cp ./run_server.sh $(INSTALL_BIN)olegdb
goinstall: server libinstall
cp $(BIN_DIR)olegdb $(INSTALL_BIN)olegdb

libinstall: liboleg
@mkdir -p $(INSTALL_LIB)
Expand Down
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ olegdb: No.
OlegDB is a ~~single-threaded, non-concurrent~~, transactionless NoSQL database
written by bitter SQL-lovers in a futile attempt to hop on the schemaless trend
before everyone realizes it was a bad move. It is primarily a C library with an
Erlang frontend for communication.
Go frontend for communication.

Dependencies
============

* A healthy fear of the end
* Erlang
* Go (>= 1.1)

Installation
============

OlegDB consists of a server written in Erlang and a C library for all of the
OlegDB consists of a server written in Go and a C library for all of the
heavy lifting. Binaries are in `build/bin/` and the library is in `build/lib/`.
Beam files are also thrown in `build/bin/`.

Expand All @@ -35,7 +35,7 @@ Currently builds are tested against gcc and clang.
```bash
# Building everything:
make
# Just the erlang beam files:
# Just the golang frontend:
make server
# Just the C library:
make liboleg
Expand All @@ -52,16 +52,11 @@ To run tests:
To run the erlang server:

```bash
olegdb <db_location>
olegdb [-conf olegdb.conf] [-bind localhost:8080] [-dir data]
```
For an explaination of the command line parameters, do `olegdb -h`

You can optionally specify a port, host or both. But not just a host.

```bash
olegdb <db_location> [[host] port]
```

curl2sudo® install script coming soon.
curl2sudo&reg; install script coming soon.

Documentation
=============
Expand Down
Loading