-
Notifications
You must be signed in to change notification settings - Fork 82
Cloudberry Middleware
This module is the entry point to the client. It sets up the web server that wraps up the middleware logics. The server is implemented by using Play Framework.
This folder contains the following configuration files
-
routes
: defines the HTTP entries. -
logback.xml
: defines the log level. -
application.conf
: defines the develop application related configurations. -
production.conf
: the same as application.conf, but is used in the online machines.
The server related Scala codes.
It defines a web server application. The HTTP entries functions defined in the routes
are implemented here.
It contains the *.scala.html
scripted HTML files that will be rendered by Play.
[To be changed]
Currently, it contains a NeoActor
which translate the JSON request from the web page to the Cloudberry JSON request. It's mainly used to simplify the front-end JS logics since the writer was more comfortable with the strong-typed language. It can be moved to the web page and let the JS send the Cloudberry request directly.
It connects the AsterixDB and checks if the berry.meta
dataset is there. The metadata will be loaded once into the memory and will be created if not found.
Some utility case classes.
The frontend resource folder. Please read the frontend documentation.
Zion
contains the kernel of the middleware work. It is composed of the following packages:
It has three types of actors to handle all the workflows.
Each web connection creates one BerryClient
that utilizes the JSONParser
and QueryPlanner
to get a group of AQLs for DataSetAgent
to execute. It also takes care of the slicing logic by updating the state
of the actor.
Each AsterixDB dataset is connected to one unique DataSetAgent
. It runs AQLs queries and updates on that dataset. The uniqueness guarantees the read
and update
consistency.
One global actor that sync with the berry.meta
AsterixDB dataset which stores the view description and relations.
Configuration file (Asterix URL, timeouts)
The object model codes
It defines the interface of the datastore related query model.
-
AQLGenerator
: It parses a Query by callinggenerate
function that generates a correspondent AQL query with some syntax validation. It usesAQLFuncVisitor
util to handle functions such as relation functions(e.g., contains, in) and aggregation functions(e.g., count, min, max). Reference 3
-
JSONParser
: It parses a given Query to a JSON record. In addition, because query is part of theDataSetInfo
which requires to be serialized and deserialized to and from AsterixDB, we also implement the write interface which can convert a Query back to a JSONRecord. Reference 1, 2
-
DataSetInfo
: It is the dataset metadata that contains Schema, CreateQuery(if it is a view), statistical information(e.g., creation time, update time, cardinality). We implemented the corresponding JSON Formater to serialize/deserialize a DataSetInfo to/from a JSONRecord, so it can be stored into AsterixDB. Reference 1, 2.
Schema model: Query, Schema, Functions types. Reference 2
- JSON Serializer / Deserializer: https://www.playframework.com/documentation/2.5.x/ScalaJsonCombinators#JSON-Reads/Writes/Format-Combinators
- Query Model Doc: https://docs.google.com/document/d/1-xTBxdIg_y_nHMpztZdEG3i_IOpeKhwIT6UQJVDL0UM/edit?usp=sharing
- AsterixDB doc (AQL language): https://ci.apache.org/projects/asterixdb/aql/manual.html
- Test cases: https://twitter.github.io/scala_school/specs.html