Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create JsonEventStore #330

Open
cjnolet opened this issue Apr 27, 2015 · 0 comments
Open

Create JsonEventStore #330

cjnolet opened this issue Apr 27, 2015 · 0 comments
Milestone

Comments

@cjnolet
Copy link
Member

cjnolet commented Apr 27, 2015

In mango, we recently created a JsonAttributeStore utility class that allows json and generically nested hashmaps to be flattened into attributes to be used in the EventStore and EntityStore implementations.

The problem is, it has partitioned a lot of assumptions that can be made about the underlying events. For instance, if I could assume that all of my events contain attributes that have been flattened from an arbitrarily nested document, I can do things like querying based on nested attributes in Spark SQL. I can also do things with my UI to determine and display the nested layers. I cannot do such things if my only assumption is that I have an attribute which is a simple key/value object.

I propose we create a new Store that is based on the event store, called EventDocumentStore or JsonEventStore. This store should assume any objects are arbitrarily nested and can be marshalled back into json when queried. This will allow us to manage the schema of the entire document (which items are arrays vs objects) and provide that schema to things like Spark SQL.

Methods in the JsonEventStore interface could look like this:

save(Iterable<JsonEvent> jsonDocuments);

JsonEvent query(Node query, Auths auths);

Where a JsonEvent looks like this:

class JsonEvent {
    String type;
    String id;
    Long timestamp;
    Map[String, Object] document;
} 

The reason I want to differentiate this object from Mango's Event object is that I want to separate the internal indexing components of the event from the document itself. An Event's ID, for instance, could possibly align with an ID in the json document itself, but it doesn't need to. This gives it flexibility as the Event's fields are just metadata that inform the store how to index while the documents themselves are completely separate entities.

@cjnolet cjnolet added this to the 2.2.0 milestone Apr 27, 2015
@cjnolet cjnolet changed the title Create an EventDocumentStore Create JsonDocumentStore Apr 27, 2015
@cjnolet cjnolet changed the title Create JsonDocumentStore Create JsonEventStore Apr 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant