This topic explains how the Lock Set data construct interacts with a pair of Lock and Unlock operators, and describes the Lock Set's options on its Properties View.
Lock Sets are collections of locks that are used together by Lock and Unlock operator. A Lock Set has a (key) schema, and a specific set of values for the schema fields will reference exactly one lock. The purpose of using a Lock and Unlock operator together is to provide exclusive access for certain tuples to a sequence of operators. This generally comes up when dealing with operators that modify shared data structures, such as Query Tables.
When a tuple enters a Lock operator, the expressions in the operator will be applied against the fields in the tuples. The expressions will generate a value X. Only one tuple that corresponds to the value X will be allowed past the Lock operator at any one time. All other tuples that evaluate to the value X will be buffered. Tuples that evaluate to values other than X will be allowed into the locked portion using the same rules. A locked portion of a StreamBase application may have multiple tuples, but the values they evaluate to must be distinct.
The remainder of this topic describes the actions you can take on each tab of the Lock Set data construct's Properties view.
Name: Every application component must have a unique name. Use this field to specify or change the component's name. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.
Description: Optionally, enter a description to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.
Use this tab to define the Lock Set's schema:
-
Use the control at the top of the Edit Schema tab to choose the schema type:
- Private schema
-
Populate the schema fields using one of these methods:
-
To define the fields manually, use the
button at the top
of the tab to add a row for each schema field. Enter values for the
Field Name and Type, and if necessary, the Size. The Description is
optional. For example:
Field Name Type Size Description symbol string 10 Stock symbol quantity int 4 Number of shares The name must begin with an alphabetic character or an underscore, can contain only alphabetic characters, numbers, and underscores, and cannot contain hyphens or other special characters.
The type must be one of the supported StreamBase Data Types. The editor fills in the size for data types with fixed sizes, but you must enter a valid size for strings and blobs, which are variable-length.
-
You can reuse an existing schema whose fields are appropriate for this component and your application. It can be a schema that you previously saved, one that you imported from your file system (as described in Importing and Exporting Resources), or one that exists in another application. To do so, click the
button. If prompted to
save the application at this point, click to continue.
In the Copy Schema dialog, identify the schema you want. See Copying Schemas for details.
The schema fields are loaded in your Fields table.
Tip
Alternatively, you can drag a saved schema from the Saved Schemas view and drop it onto the schema table in the Edit Schema tab. If you already have entries in the table, StreamBase prompts for permission to replace them with the contents of the schema you are copying.
In addition to the button, you can use the , , and buttons to edit and order your schema fields. If you have copied a schema, remember that this is a local copy: Any changes you make here do not affect the original schema that you copied.
-
- Named schema
-
If you have previously defined any named schemas for this application, you can choose one from the list. (If no named schemas exist, only the
Private Schemaoption is available.)When you choose a named schema, its fields are loaded into the Fields table. The text is grey and cannot be edited here.
Tip
You can change a named schema by editing it in the Named Schemas tab of your application's EventFlow Editor.
-
Optionally, document your schema in the Schema Description field.
