mochi / statebox Goto Github PK
View Code? Open in Web Editor NEWErlang state "monad" with merge/conflict-resolution capabilities. Useful for Riak.
License: Other
Erlang state "monad" with merge/conflict-resolution capabilities. Useful for Riak.
License: Other
This issue still exists with v0.2.3 erlang R15B0[23]
I think the variable argument fun return on line 28 makes it choke.
Maybe fun(term(), term()) | fun(term(), term(), term()) instead of fun(...) ?
: ~/erlang/statebox $ dialyzer --build_plt --output_plt combo.plt -r .
Compiling some key modules to native code... done in 0m24.82s
Creating PLT combo.plt ...
dialyzer: Analysis failed with error:
Could not scan the following file(s): [{"/Users/.../erlang/statebox/ebin/statebox.beam",
" Error while parsing #statebox{}: Unable to find type 'fun'\n\n"}]
Last messages in the log cache:
Reading files and computing callgraph...
I'm using statebox
+ statebox_riak
and I want to serialize/deserialize the statebox record to JSON, so that it's not ETF and can be read in other languages (i.e. Python Riak client is crashing on ETF binaries:). The problem is that the statebox record is not in a header file and I cannot import it to use it directly. Looking at the accessors (value/1
, last_modified/1
) and constructors (new/1
, new/2
) from statebox.erl
I don't see a way to actually (de)construct the whole statebox record to (de)serialize it. I need to (de)serialize the queue
field, right? Am I missing anything?
For now I just copied the record to my module, which is bad. Here's some code:
-spec serialize(statebox:statebox()) -> binary().
serialize(#statebox{value = Dict,
queue = Events,
last_modified = Ts}) ->
Value = orddict:fetch(key, Dict),
Queue = [serialize_event(E) || E <- Events],
Json = [{<<"value">>, Value},
{<<"queue">>, Queue},
{<<"last_modified">>, Ts}],
jsx:encode(Json).
If this is really a "bug", I would be happy to make a pull request, just let me know if you prefer to move the record into a header file or add queue/1
and new/3
.
-spec serialize(statebox:statebox()) -> binary().
serialize(Statebox) ->
Value = orddict:fetch(key, statebox:value(Statebox)),
Queue = [serialize_event(E) || E <- statebox:queue(Statebox)],
Ts = statebox:last_modified(Statebox),
Json = [{<<"value">>, Value},
{<<"queue">>, Queue},
{<<"last_modified">>, Ts}],
jsx:encode(Json).
Cheers!
Hi,
I am adapting statebox for some specific use case, and I was wondering if I understand the repeatability requirement correctly.
From what I understand, this has to do more with the use of riak-like systems where you will have more than one replica of such an operation on different vnodes, and therefore, when you merge, you'll end up with duplicate data.. and hence, the repeatability requirement โ so that replicas of the same operation don't effectively get applied twice.
Or is there any other reason for this requirement?
Lets say if I had some operation id "marker" embedded into operations that would allow me to figure out duplicates, and my own custom merge function which keeps trrack of applied operations and does not allow duplicates to be applied โ would that lift the repeatability requirement?
What's the license?
I think it has moved to "github.com/eproxus/meck"
Hi, the link to the explanatory article is broken. I found it here though: https://web.archive.org/web/20140215224525/http://labs.mochimedia.com/archive/2011/05/08/statebox/
This is with version 1.2.2
Could not scan the following file(s): [{"/Users/zkessin/Documents/ProductStructure/WebAPI/deps/statebox/ebin/statebox.beam",
" Error while parsing #statebox{}: Unable to find type 'fun'\n\n"}]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.