Add LocalBucketing with storeConfig function working - #18
Conversation
emmawillis
commented
Sep 2, 2022
- Add LocalBucketing class with all functions working (except generateBucketedConfig has the wrong return type)
- Add small test for LocalBucketing - we'll probably want to delete this when we finish the DVCLocalClient since tests for that will cover the bucketing class
- Add a local client to the test app so we can demo it
- Also renamed local/DVCClient to DVCLocalClient (do we want to do this??)
d96ee8e to
a6f4a24
Compare
d101aab to
dabe136
Compare
| private final DVCApi api; | ||
| private final DVCOptions dvcOptions; | ||
|
|
||
| private static final LocalBucketing localBucketing = new LocalBucketing(); |
There was a problem hiding this comment.
I don't think we want this to be final; static alone is fine.
| public DVCClient(String serverKey, DVCOptions dvcOptions) { | ||
| public DVCLocalClient(String serverKey, DVCOptions dvcOptions) { | ||
| new EnvironmentConfigManager(serverKey, dvcOptions); | ||
| DEFAULT_SDK_VERSION = "1.1.0"; |
There was a problem hiding this comment.
You're declaring this as final, it can be set in the initialization.
| byte[] headerBytes = {buf.get(startAddress - 1), buf.get(startAddress - 2), buf.get(startAddress - 3), buf.get(startAddress - 4)}; | ||
| long stringLength = getUnsignedInt(headerBytes); | ||
| String result = ""; | ||
| for (int i = 0; i < stringLength; i += 2) { // +=2 because every 2nd byte is null |
There was a problem hiding this comment.
Technically this comment is correct, but it's because the data is formatted as WTF-16 - not UTF-8. So technically the second byte is a valid data byte - but we're not using it, so we skip. Not that the byte is \0.
There was a problem hiding this comment.
oh that makes sense, i'll just put that it's formatted as WTF-16 instead of UTF-8, hopefully that will be more helpful
| String bucketedConfigString = readWasmString(resultAddress); | ||
|
|
||
| Map<String, Object> mapping = new ObjectMapper().readValue(bucketedConfigString, HashMap.class); | ||
| // TODO parse json as BucketedUserConfig class and return that |
There was a problem hiding this comment.
Lets make sure we finish this before merging.
There was a problem hiding this comment.
that's already finished in the next commit, i'm going to PR it right after this one. just trying to get this into the feature branch to unblock Kaushal
There was a problem hiding this comment.
Just because of how WASM is painful - I'd do it in this one.
dabe136 to
0844a1c
Compare