diff --git a/event_loop.h b/event_loop.h index 0903bb9..e9479d9 100644 --- a/event_loop.h +++ b/event_loop.h @@ -6,6 +6,7 @@ #include "utarray.h" +/* Ion: say what is this header about; add some comments */ typedef struct { /* The type of connection (e.g. redis, client, manager, data transfer). */ int type; @@ -13,6 +14,7 @@ typedef struct { void *data; } event_loop_item; +/* Ion: say what is the purpose of this data structure */ typedef struct { /* Array of event_loop_items that hold information for connections. */ UT_array *items; @@ -21,6 +23,7 @@ typedef struct { } event_loop; /* Event loop functions. */ +/* Ion: While some of the function names are selfexplanatory, some are not; please add comments */ void event_loop_init(event_loop *loop); void event_loop_free(event_loop *loop); int64_t event_loop_attach(event_loop *loop, diff --git a/state/db.h b/state/db.h index b586f9a..f43ab53 100644 --- a/state/db.h +++ b/state/db.h @@ -8,19 +8,23 @@ typedef struct db_conn_impl db_conn; /* Connect to the global system store at address and port. The last * parameter is an output parameter and we assume the memory is * allocated by the caller. */ + /* Ion: don't we return errors? */ + /* Ion: what about sharding? the API below assume a single instance, no? */ void db_connect(const char *db_address, int db_port, - const char *client_type, + const char *client_type, /* Ion: say what type is */ const char *client_addr, int client_port, db_conn *db); /* Attach global system store onnection to event loop. Returns the index of the * connection in the loop. */ + /* Ion: what are the event loop arguments */ int64_t db_attach(db_conn *db, event_loop *loop, int connection_type); /* This function will be called by the user if there is a new event in the * event loop associated with the global system store connection. */ + /* Ion: so is db_event() an argeument in db_attach() ? */ void db_event(db_conn *db); /* Disconnect from the global system store. */ diff --git a/state/object_table.h b/state/object_table.h index 6b4d62e..919b56c 100644 --- a/state/object_table.h +++ b/state/object_table.h @@ -4,12 +4,16 @@ typedef void (*lookup_callback)(void *); /* Register a new object with the directory. */ +/* Ion: don't we need to specify the ID of the node the object is stored on? */ +/* Ion: we should return errors, no? */ void object_table_add(db_conn *db, unique_id object_id); /* Remove object from the directory */ +/* Ion: same as above; the node the object is stored on? errors? */ void object_table_remove(db_conn *db, unique_id object_id); /* Look up entry from the directory */ +/* Ion: what are the arguments of the callback ? */ void object_table_lookup(db_conn *db, unique_id object_id, lookup_callback callback); diff --git a/state/redis.h b/state/redis.h index 471044b..1edf4c1 100644 --- a/state/redis.h +++ b/state/redis.h @@ -6,6 +6,7 @@ struct db_conn_impl { /* String that identifies this client type. */ + /* Ion: say more about what the client type is */ char *client_type; /* Unique ID for this client within the type. */ int64_t client_id; @@ -17,6 +18,7 @@ struct db_conn_impl { event_loop *loop; }; +/* Ion: say what the next functions are doing and what are the arguments, i.e., r and privdata */ void object_table_fetch_addr_port(redisAsyncContext *c, void *r, void *privdata);