Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions event_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

#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;
/* Data associated with the connection (managed by the user) */
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;
Expand All @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion state/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
4 changes: 4 additions & 0 deletions state/object_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 2 additions & 0 deletions state/redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down