nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

block.h (731B)


      1 
      2 #ifndef NDB_BLOCK_H
      3 #define NDB_BLOCK_H
      4 
      5 #include "invoice.h"
      6 #include "str_block.h"
      7 #include "cursor.h"
      8 #include "nostr_bech32.h"
      9 #include "nostrdb.h"
     10 #include <inttypes.h>
     11 
     12 #define NDB_BLOCK_FLAG_OWNED 1
     13 
     14 #pragma pack(push, 1)
     15 
     16 struct ndb_blocks {
     17 	unsigned char version;
     18 	unsigned char flags;
     19 	unsigned char padding[2];
     20 
     21 	uint32_t words;
     22 	uint32_t num_blocks;
     23 	uint32_t blocks_size;
     24 	// future expansion
     25 	uint32_t total_size;
     26 	uint32_t reserved;
     27 	unsigned char blocks[0]; // see ndb_block definition
     28 };
     29 
     30 #pragma pack(pop)
     31 
     32 int push_str_block(struct cursor *buf, const char *content, struct ndb_str_block *block);
     33 int pull_str_block(struct cursor *buf, const char *content, struct ndb_str_block *block);
     34 
     35 
     36 #endif // NDB_BLOCK_H