MCPcopy Create free account
hub / github.com/ElementsProject/lightning / db_datastore_next

Function db_datastore_next

wallet/datastore.c:108–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108struct db_stmt *db_datastore_next(const tal_t *ctx,
109 struct db_stmt *stmt,
110 const char **startkey,
111 const char ***key,
112 const u8 **data,
113 u64 *generation)
114{
115 if (!db_step(stmt))
116 return tal_free(stmt);
117
118 *key = db_col_datastore_key(ctx, stmt, "key");
119
120 /* We select from startkey onwards, so once we're past it, stop */
121 if (startkey && !datastore_key_startswith(*key, startkey)) {
122 db_col_ignore(stmt, "data");
123 db_col_ignore(stmt, "generation");
124 return tal_free(stmt);
125 }
126
127 if (data)
128 *data = db_col_arr(ctx, stmt, "data", u8);
129 else
130 db_col_ignore(stmt, "data");
131
132 if (generation)
133 *generation = db_col_u64(stmt, "generation");
134 else
135 db_col_ignore(stmt, "generation");
136
137 return stmt;
138}
139
140struct db_stmt *db_datastore_first(const tal_t *ctx,
141 struct db *db,

Callers 3

db_datastore_firstFunction · 0.70
wallet_datastore_nextFunction · 0.70
downgrade_askrene_layersFunction · 0.50

Calls 6

db_stepFunction · 0.85
tal_freeFunction · 0.85
db_col_datastore_keyFunction · 0.85
datastore_key_startswithFunction · 0.85
db_col_ignoreFunction · 0.85
db_col_u64Function · 0.85

Tested by

no test coverage detected