Comments (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)
- NewSymKeyClient*: two constructors could be made into one while making a clear and simpler API HOT 4
- all: Apache 2.0 license header isn't being properly applied as the first item in each file except if with build tags HOT 1
- example_test.go: attempt to always use public APIs in examples to make for standalone copy and pastable code HOT 1
- all: package name should be `e4` and not `e4go` HOT 1
- Spurious use of hex.Encode for hashmaps HOT 5
- Precompute shared secret with C2 HOT 1
- s/ErrTooShortCipher/ErrTooShortCiphertext/
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from e4go.