Merged branch 'master' of git://git.tokkee.org/sysdb.
plugin: Record all loaded plugins and use that for improved error messages.
frontend: Make the number of handler threads configurable.
The number is passed to listen_and_serve() as part of sdb_fe_loop_t.
The number is passed to listen_and_serve() as part of sdb_fe_loop_t.
frontend: Return an error if no handler threads could be created.
frontend: Implemented simplified error handling when creating threads.
There's hardly any reasonable error condition that might happen, so this
rather simplied approach should be sufficient.
There's hardly any reasonable error condition that might happen, so this
rather simplied approach should be sufficient.
client: Let sdb_client_recv() use sdb_proto_select().
proto utils: Added sdb_proto_select().
This is a simple wrapper around select(2) to be used in cases where we only
care about a single file-descriptor being ready for a particular operation.
This is a simple wrapper around select(2) to be used in cases where we only
care about a single file-descriptor being ready for a particular operation.
frontend/sock_test: Try to connect to the server socket.
This verifies that the socket is actually usable.
Also, it fixes a race condition in the test. The UNIX socket file is already
created when adding the listener. Thus, the previous synchronization between
the main thread and the socket handler thread did not work in most cases.
This verifies that the socket is actually usable.
Also, it fixes a race condition in the test. The UNIX socket file is already
created when adding the listener. Thus, the previous synchronization between
the main thread and the socket handler thread did not work in most cases.
frontend: Clean up UNIX sockets when closing a listener.
frontend: Let listen_and_serve() return early if do_loop == 0.
That is, do not (re-)open any sockets.
That is, do not (re-)open any sockets.
frontend/sock_test: Added initial tests for frontend code.
.gitignore: Ignore sysdb / sysdbd only as src/sysdb / src/sysdbd.
Moved connection-private.h from src/include/frontend/ to src/frontend/.
This header is not meant to be used anyway else, so don't lead people into
temptation.
This header is not meant to be used anyway else, so don't lead people into
temptation.
Moved sysdb and sysdbd sources to src/tools/.
Also, moved all purely private headers to that directory as well.
Renamed some files for greater consistency.
Also, moved all purely private headers to that directory as well.
Renamed some files for greater consistency.
.gitignore: Ignore ar-lib.
sysdb: Use a string buffer and simple (stupid) ';' EO-query checks.
Use a different prompt (similar to psql) when inside a query.
Use a different prompt (similar to psql) when inside a query.
configure: Fixed some automake warnings.
doc/Makefile: Use SUFFIXES rather than GNU-specific %-style rules.
strbuf_test: Added tests for sdb_strbuf_clear().
strbuf_test: Added a couple of tests operating on a zero-size buffer.
This is mostly about checking that this does not crash.
This is mostly about checking that this does not crash.
strbuf utils: Added sdb_strbuf_clear().
sysdb: Free memory allocated by readline().
sysdb: Don't warn about missing history file when loading history.
sysdb: Check for and use libedit/libreadline for command input.
dbi utils: Don't keep invalid object address after closing DBI connections.
frontend: Remove stale UNIX sockets before trying to bind().
client: Report client socket errors using error utils.
sysdb: Exit, if the current user could not be determined.
Merged branch 'master' of git://git.tokkee.org/sysdb.
sysdb: Use error utilities.
error utils: Make the logger callback configurable.
Don't depend on the plugin module anymore. Rather, add sdb_error_set_logger()
which may be used to set a callback to be used for all logging. Default to
printing to stderr.
sysdbd now uses that to register sdb_plugin_log as logger callback.
Don't depend on the plugin module anymore. Rather, add sdb_error_set_logger()
which may be used to set a callback to be used for all logging. Default to
printing to stderr.
sysdbd now uses that to register sdb_plugin_log as logger callback.
Moved core/error to utils/error.
Later, we'll use the module from the daemon and client.
Later, we'll use the module from the daemon and client.
sysdb: Connect to the server and issue a STARTUP command.
The current username is sent along with the STARTUP command.
The current username is sent along with the STARTUP command.
sysdbd: Send SIGINT to backend thread when shutting down.
This will interrupt the sleep call and make the thread shut down faster.
This will interrupt the sleep call and make the thread shut down faster.
proto utils: Fixed offset check in get_int().
Let sdb_client_connect() send a username to the server.
… using a STARTUP message.
… using a STARTUP message.
frontend: Split connection status constants into a separate header.
This will allow the client to use it as well.
This will allow the client to use it as well.
store_test: Fixed golden data for tojson() test.
Merged branch 'master' of git://git.tokkee.org/sysdb.
store_test: Added a test for tojson().
store: tojson(): Comma-separate multiple hosts.
Run all tests using TZ=UTC.
This will ensure consistent time formatting.
This will ensure consistent time formatting.
t/core/store_test: Added initial tests for the object store.
For now, testing basic insertion operations.
For now, testing basic insertion operations.
store: Don't try to update non-existent attributes.
object_test: Added test for sdb_object_cmp_by_name().
object_test: Added tests for wrapped object and memory management.
Updated various copyright notices to 2012-2013.
sysdbd: Changed -d option to -D and default to daemonizing the process.
It doesn't really matter much what the default is but -d should be reserved
for debugging.
It doesn't really matter much what the default is but -d should be reserved
for debugging.
sysdbd: Fixed a typo.
sysdb: Added a initial client implementation.
For now, this is basically a placeholder.
For now, this is basically a placeholder.
client: Let client_recv() read a full response.
… and block if necessary. There is no reason that a client should handle
partial responses.
… and block if necessary. There is no reason that a client should handle
partial responses.
client: Let client_recv() not pass unparsed status,len to the caller.
strbuf_test: Added skip() tests using various offsets.
util strbuf: Let skip() support an offset.
That is, add support for removing bytes from the middle of the buffer.
That is, add support for removing bytes from the middle of the buffer.
Added version functions to libsysdbclient.
This is basically the same as the sdb_version() functions but to be used only
in the client lib.
This is basically the same as the sdb_version() functions but to be used only
in the client lib.
Link proto and strbuf utilities into libsysdbclient.
Added initial client library implementation.
For now, this includes a network client only.
For now, this includes a network client only.
utils proto: Added sdb_proto_get_int().
This function “recieves” a 32bit integer from a string buffer and converts it
from network to host byte order.
This function “recieves” a 32bit integer from a string buffer and converts it
from network to host byte order.
utils proto: Added utility functions for protocol handling.
So far, added functions to send data to an open file descriptor and use that
in the frontend code.
So far, added functions to send data to an open file descriptor and use that
in the frontend code.
Merged branch 'master' of git://git.tokkee.org/sysdb.
Conflicts:
t/Makefile.am
t/libsysdb_test.c
t/libsysdb_test.h
Conflicts:
t/Makefile.am
t/libsysdb_test.c
t/libsysdb_test.h
.gitignore: Added check test logs.
t/: Added initial tests for core/object.
object: Be more specific about requirements for the 'destroy' callback.
object: Ensure that a type's destroy callback is called if init fails.
Else, failed init may leak memory.
Else, failed init may leak memory.
frontend: Unified error reporting to the client.
Keep track of the latest error in a connection object and report that back to
the client in case a command handler failed.
Keep track of the latest error in a connection object and report that back to
the client in case a command handler failed.
store: Let tojson() embed errors into JSON rather than aborting.
Renamed sdb_session_start() to sdb_fe_session_start().
frontend: Added a simple 'LIST' command.
This command sends a JSON representation of the whole store to the client.
This command sends a JSON representation of the whole store to the client.
store: Replaced store_dump() with store_tojson().
The new function serializes the store as JSON and writes the result to a
string buffer.
The new function serializes the store as JSON and writes the result to a
string buffer.
strbuf test: Further extended the incremental append test.
utils strbuf: Handle nul-byte correctly.
A corner-case was not handled correctly before: when writing just enough
characters to the buffer that it would then be full, a resize was attempted
without changing the size of the buffer, leading to an endless loop in
vappend(). This was caused by not taking into account the space required for
the trailing nul-byte.
A test-case which exposes this problem has also been added.
A corner-case was not handled correctly before: when writing just enough
characters to the buffer that it would then be full, a resize was attempted
without changing the size of the buffer, leading to an endless loop in
vappend(). This was caused by not taking into account the space required for
the trailing nul-byte.
A test-case which exposes this problem has also been added.
src/Makefile: Install all public header files.
frontend: Moved all connection handling operations into connection.c.
connection_obj_t was merged into sdb_conn_t which now inherits from
sdb_object_t. The connection object is now private to the library and defined
in the new header file connection-private.h.
connection_obj_t was merged into sdb_conn_t which now inherits from
sdb_object_t. The connection object is now private to the library and defined
in the new header file connection-private.h.
frontend: Report back invalid commands.
frontend: Handle STARTUP and PING commands.
Implemented an initial, trivial "framework" for session handling /
authentication. Simply send back OK status for now.
Fixed preconditions for initialization and handling of commands.
Implemented an initial, trivial "framework" for session handling /
authentication. Simply send back OK status for now.
Fixed preconditions for initialization and handling of commands.
frontend: Moved connection init/close to connection.c.
frontend/sock: Fixed an info message.
;-)
;-)
frontend/connection: Reset state after handling a command.
frontend/connection: Try to handle as much as possible in read().
Else, we might have to wait for more data before being able to process a
command.
Else, we might have to wait for more data before being able to process a
command.
frontend: Added module for generic connection handling.
Merged branch 'master' of git://git.tokkee.org/sysdb.
socket frontend: Notify about incomplete commands before closing connections.
utils strbuf: Advance buffer position in sdb_strbuf_read().
socket frontend: Read incoming commands into a buffer.
Handle commands once all of them has been read. Give preference to reading
data over handling a command in order not to block clients or exhaust
operating system buffers.
Handle commands once all of them has been read. Give preference to reading
data over handling a command in order not to block clients or exhaust
operating system buffers.
strbuf_test: Added some NULL tests.
These are mainly to check that the functions do no segfault but report an
error.
These are mainly to check that the functions do no segfault but report an
error.
strbuf_test: Added tests for len / nil-termination after skip().
utils strbuf: Added sdb_strbuf_skip().
This function may be used to remove bytes and the beginning of the buffer.
This function may be used to remove bytes and the beginning of the buffer.
socket frontend: Merged connection_obj_t and connection_t.
There's no reason for two separate structs.
There's no reason for two separate structs.
utils strbuf: Added sdb_strbuf_read().
This function may be used to read from an open file into the buffer.
This function may be used to read from an open file into the buffer.
utils strbuf: Added memcpy and memappend functions.
These functions may be used to write arbitrary data to a string buffer.
These functions may be used to write arbitrary data to a string buffer.
socket frontend: Cleaned up main handler loop a bit.
socket frontend: Try to reopen a connection if it has been closed.
socket frontend: Close sockets on error as well.
socket frontend: Close listening sockets before returning.
Also, cleaned up listener handling a bit.
Also, cleaned up listener handling a bit.
socket frontend: Disallow duplicate listen_and_serve() calls.
… and fixed a memory leak.
… and fixed a memory leak.
socket frontend: Don't use UTF-8 in comments ;-)
socket frontend: Let handler read from open connection.
Close the connection on EOF and pass back the connection to the main loop in
case no data is currently available (read() would block).
Close the connection on EOF and pass back the connection to the main loop in
case no data is currently available (read() would block).
socket frontend: Pass socket object to handler threads.
This will allow them to pass back connections to the main loop.
This will allow them to pass back connections to the main loop.
socket frontend: Renamed accept_connection → connection_accept.
socket frontend: Use nonblocking I/O for open connections.