Documentation ¶
Index ¶
- func CacheFilename(ent *CacheEntry) string
- func CacheFilenameWithName(ent *CacheEntry, name, ext string) string
- func SaveCacheToFile(cache *Cache, filename string) error
- func SetUp() cli.Command
- func StateCacheFilename(ent *CacheEntry, stateName string) string
- type Cache
- type CacheEntry
- type Statement
- type Statements
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheFilename ¶
func CacheFilename(ent *CacheEntry) string
CacheFilename computes the filename from a cache entry.
func CacheFilenameWithName ¶
func CacheFilenameWithName(ent *CacheEntry, name, ext string) string
CacheFilenameWithNodeName computes the filename from a cache entry with a custom node name.
func SaveCacheToFile ¶
SaveCacheToFile saves Cache to a file.
func StateCacheFilename ¶
func StateCacheFilename(ent *CacheEntry, stateName string) string
Types ¶
type Cache ¶
type Cache struct { Seed string `json:"seed"` Applied []*CacheEntry `json:"applied"` Outdated []*CacheEntry `json:"outdated"` // contains filtered or unexported fields }
Cache has information of cached results generated from each BQL statement.
func LoadCacheFromFile ¶
LoadCacheFromFile loads Cache from a file.
func (*Cache) Get ¶
func (c *Cache) Get(i int) *CacheEntry
Get returns i-th CacheEntry in the cache. It returns nil if the index is out of bounds.
func (*Cache) Node ¶
func (c *Cache) Node(name string) *CacheEntry
Node returns a CacheEntry of a data source node (a source or a stream) having the name.
func (*Cache) TruncateAfter ¶
TruncateAfter removes all cache information after i-th position. For example, if the cache has three entries [a, b, c], TruncateAfter(0) removes b and c, and only a remains.
type CacheEntry ¶
type CacheEntry struct { NodeName string `json:"node_name,omitempty"` Hash string `json:"hash"` Stmt string `json:"stmt"` States []string `json:"states"` Timestamp time.Time `json:"timestamp"` }
CacheEntry has an cache information of a specific BQL statement.
type Statement ¶
type Statement struct {
Stmt interface{}
}
Statement is a wrapper of BQL statement structs.
func NewStatement ¶
NewStatement creates a Statement from a BQL statement. Currently, following statements are not supported:
- SELECT (CREATE STREAM is supported)
- UPDATE SOURCE/SINK/STATE
- DROP SOURCE/STREAM/SINK/STATE
- SAVE/LOAD STATE (they are automatically saved)
func (*Statement) Input ¶
Input returns input node names of SELECT statements. It doesn't support Sinks.
func (*Statement) IsCreateStateStatement ¶
IsCreateStateStatement returns true when the statement is CREATE STATE. Because LOAD STATE isn't supported by the command, it only check if the statement is CREATE STATE.
func (*Statement) IsDataSourceNodeQuery ¶
IsDataSourceNodeQuery returns true if the statement creates or manipulate a data source node, which is a source or a stream.
func (*Statement) IsInsertStatement ¶
IsInsertStatement returns true when the statement is INSERT INTO.
type Statements ¶
type Statements struct {
Stmts []*Statement
}
Statements is a collection of Statement.
func Parse ¶
func Parse(bql string) (*Statements, error)
Parse parses BQL statements and create Statements.