GithubHelp home page GithubHelp logo

Comments (1)

diagprov avatar diagprov commented on June 1, 2024 1

For inspiration, here is the current libe4 storage API:

/* the e4storage type pre-defined above implements these API calls */
int e4c_init(e4storage *store);
int e4c_set_storagelocation(e4storage *store, const char *path);
int e4c_load(e4storage *store, const char *path);
int e4c_sync(e4storage *store);
int e4c_set_id(e4storage *store, const uint8_t *id);
int e4c_is_device_ctrltopic(e4storage *store, const char *topic);
int e4c_getindex(e4storage *store, const char *topic);
int e4c_gettopickey(uint8_t *key, e4storage *store, const int index);
int e4c_set_topic_key(e4storage *store, const uint8_t *topic_hash, const uint8_t *key);
int e4c_remove_topic(e4storage *store, const uint8_t *topic_hash);
int e4c_reset_topics(e4storage *store);

#ifdef E4_MODE_SYMKEY
int e4c_set_idkey(e4storage *store, const uint8_t *key);
#endif
#ifdef E4_MODE_PUBKEY 
/* pubkey storage apis */
int e4c_set_idpubkey(e4storage *store, const uint8_t *pubkey);
int e4c_set_idseckey(e4storage *store, const uint8_t *key);
int e4c_get_idseckey(e4storage* store, uint8_t *key);
int e4c_get_idpubkey(e4storage* store, uint8_t *key);
int e4c_getdeviceindex(e4storage *store, const uint8_t* id);
int e4c_getdevicekey(uint8_t* key, e4storage *store, const int index);
int e4c_set_device_key(e4storage *store, const uint8_t *id, const uint8_t *key);
int e4c_remove_device(e4storage* store, const uint8_t* id);
int e4c_reset_devices(e4storage* store);
int e4c_set_c2_pubkey(e4storage* store, const uint8_t* key);
int e4c_get_c2_pubkey(e4storage* store, uint8_t* key);
#endif

This is a bit peculiar to the C implementation and there is a separate find and retrieve path choice mostly because C and partly because that's how it was originally.

There will be some modifications to this, in particular I intend to provide functions to give constant pointers to certain bits of information to break the dependency between the struct and the implementation that currently exists and should not. I may also make storages check capabilities, because it's hard to enforce the right type of storage in C.

It might also evolve if we need to support better underlying data types and there is some requirement for that.

from e4go.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.