Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.util.List;
- interface Row {
- /*
- Single row of data. An implementation of this interface is, roughly, a table schema.
- */
- // Get the row's partition key. This can be any value (not necessarily unique). We try to put
- // rows with similar partition keys in the same index.
- public int getPartitionKey();
- }
- interface QueryEngine {
- /*
- Lives on a query server. Generates a query plan (query functions and target keys) for any user-submitted query.
- */
- // Generate a query plan for a user-submitted query.
- public queryPlan planQuery(String query);
- }
- interface Index {
- /*
- Stores a shard of data. Probably contains an internal index structure for fast queries.
- For durability, can be saved as files to persistent storage (S3?) and reconstructed.
- */
- // Add a new row to the index.
- public int addRow(Row row);
- // Create files from which index can be reconstructed.
- public List<String> indexToData();
- // Reconstruct index from files.
- public int indexFromData(List<String> data);
- }
- interface queryPlan {
- /*
- Map a query on indexes, then reduce into a result.
- */
- // On which keys should the query execute?
- public List<Integer> keysForQuery();
- // Execute the query on an index (Map).
- public ObjectOutputStream queryIndex(Index index);
- // Aggregate the outputs of queries on indexes (Reduce).
- public String aggregateIndexQueries(List<ObjectInputStream> indexQueryResults);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement