hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
session.H
Go to the documentation of this file.
1 /*
2  * session : shorthand for running sessions to accumulate structured data
3  */
4 
5 #ifndef HOG_SESSION_H_INCLUDED
6 #define HOG_SESSION_H_INCLUDED
7 
8 #include <hobbes/hobbes.H>
9 #include <hobbes/storage.H>
10 #include <hobbes/db/series.H>
11 
12 namespace hog {
13 
14 struct Session {
15  // the file being written into
17 
18  // sections of the file for structured data
19  typedef std::vector<hobbes::StoredSeries*> StoredSeriess;
20  StoredSeriess streams;
21 
22  // functions for actually writing stream data
24  typedef std::vector<WriteFn> WriteFns;
25 
26  WriteFns writeFns;
27 
28  // scratch space to accumulate transaction descriptions
29  // (just used for manual-commit sessions)
30  std::vector<size_t> txnScratch;
31 };
32 
33 // initStorageSession : make a unique storage file and a function to write transactions into it
34 typedef std::function<void(hobbes::storage::Transaction&)> ProcessTxnF;
35 ProcessTxnF initStorageSession(Session* s, const std::string& dirPfx, hobbes::storage::PipeQOS qos, hobbes::storage::CommitMethod cm, const hobbes::storage::statements& stmts);
36 
37 // common way to prepare output directories from dir prefix patterns
38 std::string ensureDirExists(const std::string& dirPfx);
39 
40 }
41 
42 #endif
43 
std::function< void(hobbes::storage::Transaction &)> ProcessTxnF
Definition: session.H:34
void(* WriteFn)(hobbes::storage::Transaction *)
Definition: session.H:23
StoredSeriess streams
Definition: session.H:20
Definition: session.H:14
Definition: batchrecv.C:20
std::vector< statement > statements
Definition: storage.H:1718
CommitMethod
Definition: storage.H:1492
hobbes::writer * db
Definition: session.H:16
Definition: file.H:225
std::vector< WriteFn > WriteFns
Definition: session.H:24
Definition: storage.H:1748
WriteFns writeFns
Definition: session.H:26
ProcessTxnF initStorageSession(Session *s, const std::string &dirPfx, storage::PipeQOS qos, storage::CommitMethod cm, const storage::statements &stmts)
Definition: session.C:85
std::string ensureDirExists(const std::string &dirPfx)
Definition: session.C:60
std::vector< hobbes::StoredSeries * > StoredSeriess
Definition: session.H:19
std::vector< size_t > txnScratch
Definition: session.H:30
PipeQOS
Definition: storage.H:409