A unique identifier (name) for the lockset.
The identifier of a previously-defined named schema. Imports all of the named schema's fields. No parentheses are required, and no other fields are permitted. Named schemas must be defined in dependency order. If a schema is used before it is defined, an error results.
A schema definition, delimited by parentheses, in the following format:
A field definition takes the form:
A unique name for a field in the schema associated with the stream. For table indexes, if the field references a named schema, the entire schema is used as the key.
One of the supported StreamBase data types.
The following statements create a named schema and then reference it in a lockset:
CREATE SCHEMA SymbolSchema (ID int, Symbol string, Price double); CREATE LOCKSET Lockset1 SymbolSchema;
The same lockset could have been defined using an anonymous schema, like this:
CREATE LOCKSET Lockset1 (ID int, Symbol string, Price double);
Here are two more examples of locksets with anonymous schemas:
CREATE LOCKSET Lockset2 (ID int, Symbol string, Price double); CREATE LOCKSET Lockset3 (ss SymbolSchema, Quantity int);
The second anonymous schema combines a reference to the named schema shown earlier with another field. It is equivalent to:
ss (ID int, Symbol string, Price double), Quantity int
The LOCK and UNLOCK statements can control the flow of tuples in an application by buffering tuples based on some condition in the LOCK statement, which can then be released by the UNLOCK statement. A LOCKSET manages the locks and their state.
A LOCKSET can be defined with a onefield or multi-field key. Paired LOCK and UNLOCK statements must use the same key to manage a lock within the LOCKSET. A single LOCKSET can manage multiple locks (as long as they use the same combination of field types for the key) and therefore can be used by multiple LOCK/UNLOCK statement pairs.