Storm Types

Storm Objects are used as view objects for manipulating data in the Storm Runtime and in the Cortex itself.

Bool

No doc for Bool

Bytes

No doc for Bytes

Bytes.bunzip()

Decompress the bytes using bzip2 and return them.

Example:

$foo = $mybytez.bunzip()

Bytes.bzip()

Compress the bytes using bzip2 and return them.

Example:

$foo = $mybytez.bzip()

Bytes.decode(encoding=’utf8’)

Decode a bytes to a string.

Args:
encoding (str): The encoding to use when decoding the bytes.

Bytes.gunzip()

Decompress the bytes using gzip and return them.

Example:

$foo = $mybytez.gunzip()

Bytes.gzip()

Compress the bytes using gzip and return them.

Example:

$foo = $mybytez.gzip()

Bytes.json()

Load JSON data from bytes.

Example:

$foo = $mybytez.json()

CmdOpts

A dictionary like object that holds a reference to a command options namespace. ( This allows late-evaluation of command arguments rather than forcing capture )

CronJob

Implements the STORM api for a cronjob instance.

CronJob.pack()

No doc for CronJob.pack

CronJob.pprint()

No doc for CronJob.pprint

CronJob.set(name, valu)

Set an editable field in the cron job definition.

Example:
$lib.cron.get($iden).set(name, “foo bar cron job”)

Dict

No doc for Dict

Gate

No doc for Gate

HttpResp

No doc for HttpResp

HttpResp.json()

No doc for HttpResp.json

Layer

Implements the STORM api for a layer instance.

Layer.addPull(url, offs=0)

Configure the layer to pull edits from a remote layer/feed.

Args:
url (str): The telepath URL to a layer/feed. offs (int): The (optional) offset to begin from.
Perms:
  • admin privs are required on the layer.
  • lib.telepath.open.<scheme>

Layer.addPush(url, offs=0)

Configure the layer to push edits to a remote layer/feed.

Args:
url (str): A telepath URL of the target layer/feed. offs (int): The local layer offset to begin pushing from (default: 0).
Perms:
  • admin privs are required on the layer.
  • lib.telepath.open.<scheme>

Layer.delPull(iden)

Remove a pull config from the layer. Args:

iden (str): The GUID of the push config to remove.
Perms:
  • admin privs are required on the layer.

Layer.delPush(iden)

Remove a push config from the layer. Args:

iden (str): The GUID of the push config to remove.
Perms:
  • admin privs are required on the layer.

Layer.edits(offs=0, wait=True, size=None)

Yield (offs, nodeedits) tuples from the given offset. If wait=True, also consume them in real-time once caught up.

Layer.get(name, defv=None)

No doc for Layer.get

Layer.getFormCounts()

Get the formcounts for the Layer.

Example:

Get the formcounts for the current :ayer:

$counts = $lib.layer.get().getFormCounts()
Returns:
Dictionary containing form names and the count of the nodes in the Layer.

Layer.getPropCount(propname, maxsize=None)

Return the number of property rows in the layer for the given full form/property name.

Example:
$count = $lib.layer.get().getPropCount(inet:ipv4:asn)

Layer.getStorNodes()

Yield (buid, sode) tuples represeting the data stored in this layer.

NOTE: “storage nodes” (or “sodes”) represent only the data stored in
the layer and may not represent whole nodes.

Layer.getTagCount(tagname, formname=None)

Return the number of tag rows in the layer for the given tag name and optional form name.

Example:
$count = $lib.layer.get().getTagCount(foo.bar, formname=inet:ipv4)

Layer.pack()

No doc for Layer.pack

Layer.repr()

No doc for Layer.repr

Layer.set(name, valu)

No doc for Layer.set

List

No doc for List

List.append(valu)

Append a value to the list.

List.has(valu)

No doc for List.has

List.index(valu)

Return a single field from the list by index.

List.length()

Return the length of the list.

List.pop()

Pop and return the last entry in the list.

List.size()

Return the length of the list.

ModelForm

No doc for ModelForm

ModelForm.prop(name)

No doc for ModelForm.prop

ModelProp

No doc for ModelProp

ModelTagProp

No doc for ModelTagProp

ModelType

A Storm types wrapper around a lib.types.Type

ModelType.norm(valu)

No doc for ModelType.norm

ModelType.repr(valu)

No doc for ModelType.repr

Node

Implements the STORM api for a node instance.

Node.edges(verb=None)

Yields the (verb, iden) tuples for this nodes edges.

Node.form()

No doc for Node.form

Node.getByLayer()

Return a dict you can use to lookup which props/tags came from which layers.

Node.getStorNodes()

Return a list of “storage nodes” which were fused from the layers to make this node.

Node.globtags(glob)

No doc for Node.globtags

Node.iden()

Get the iden of the Node.

Returns:
String value for the Node’s iden.

Node.isform(name)

No doc for Node.isform

Node.ndef()

No doc for Node.ndef

Node.pack(dorepr=False)

Return the serializable/packed version of the Node.

Args:
dorepr (bool): Include repr information for human readable versions of properties.
Returns:
(tuple): An (ndef, info) node tuple.

Node.repr(name=None, defv=None)

Get the repr for the primary property or secondary propert of a Node.

Args:

name (str): Optional name of the secondary property to get the repr for.

defv (str): Optional default value to return if the secondary property does not exist.

Returns:
String repr for the property.
Raises:
s_exc.StormRuntimeError: If the secondary property does not exist for the Node form.

Node.tags(glob=None)

No doc for Node.tags

Node.value()

No doc for Node.value

NodeData

No doc for NodeData

NodeData.get(name)

No doc for NodeData.get

NodeData.list()

No doc for NodeData.list

NodeData.load(name)

No doc for NodeData.load

NodeData.pop(name)

No doc for NodeData.pop

NodeData.set(name, valu)

No doc for NodeData.set

NodeProps

No doc for NodeProps

NodeProps.get(name, defv=None)

No doc for NodeProps.get

NodeProps.list()

No doc for NodeProps.list

Path

No doc for Path

Path.idens()

No doc for Path.idens

Path.listvars()

List variables available in the path of a storm query.

Path.trace()

No doc for Path.trace

PathMeta

Put the storm deref/setitem/iter convention on top of path variables.

PathVars

Put the storm deref/setitem/iter convention on top of path variables.

Pipe

A Storm Pipe provides fast ephemeral queues.

Pipe.put(item)

Add a single item to the Pipe.

Args:
item: An object to add to the Pipe.

Pipe.puts(items)

Add a list of items to the Pipe.

Args:
items (list): A list of items to add.

Pipe.size()

Retrieve the number of items in the Pipe.

Returns:
int: The number of items in the Pipe.

Pipe.slice(size=1000)

Return a list of up to size items from the Pipe.

Args:
size: The max number of items to return (default 1000)
Returns:
list: A list of at least 1 item from the Pipe.

Pipe.slices(size=1000)

Yield lists of up to size items from the Pipe. The loop will exit when the Pipe is closed and empty.

Args:
size (int): The max number of items to yield per slice.
Returns:
generator

Examples:

for $slice in $pipe.slices(1000) {
for $item in $slice { $dostuff($item) }

}

for $slice in $pipe.slices(1000) {
$dostuff_batch($slice)

}

Query

A storm primitive representing an embedded query.

Query.exec()

No doc for Query.exec

Queue

A StormLib API instance of a named channel in the cortex multiqueue.

Queue.cull(offs)

No doc for Queue.cull

Queue.get(offs=0, cull=True, wait=True)

No doc for Queue.get

Queue.gets(offs=0, wait=True, cull=False, size=None)

No doc for Queue.gets

Queue.pop(offs=None)

No doc for Queue.pop

Queue.put(item)

No doc for Queue.put

Queue.puts(items)

No doc for Queue.puts

Queue.size()

No doc for Queue.size

Role

No doc for Role

Role.addRule(rule, gateiden=None)

No doc for Role.addRule

Role.delRule(rule, gateiden=None)

No doc for Role.delRule

Role.get(name)

No doc for Role.get

Role.setRules(rules, gateiden=None)

No doc for Role.setRules

Set

No doc for Set

Set.add(*items)

No doc for Set.add

Set.adds(*items)

No doc for Set.adds

Set.has(item)

No doc for Set.has

Set.list()

No doc for Set.list

Set.rem(*items)

No doc for Set.rem

Set.rems(*items)

No doc for Set.rems

Set.size()

No doc for Set.size

StatTally

A tally object.

$tally = $lib.stats.tally()

$tally.inc(foo)

for $name, $total in $tally { }

StatTally.get(name)

No doc for StatTally.get

StatTally.inc(name, valu=1)

No doc for StatTally.inc

StormHiveDict

No doc for StormHiveDict

StormHiveDict.get(name, default=None)

No doc for StormHiveDict.get

StormHiveDict.list()

No doc for StormHiveDict.list

StormHiveDict.pop(name, default=None)

No doc for StormHiveDict.pop

StormHiveDict.set(name, valu)

No doc for StormHiveDict.set

Str

No doc for Str

Str.encode(encoding=’utf8’)

Encoding a text values to bytes.

Args:
encoding (str): Encoding to use. Defaults to utf8.

Str.endswith(text)

No doc for Str.endswith

Str.ljust(size)

No doc for Str.ljust

Str.lower()

Get a lowercased the of the string.

Examples:

Printing a lowercased string:

$foo="Duck"
$lib.print($foo.lower())

Str.lstrip(chars=None)

Remove leading characters from a string.

Args:
chars (str): A list of characters to remove. If not specified, whitespace is stripped.
Examples:

Removing whitespace and specific characters:

$strippedFoo = $foo.lstrip()
$strippedBar = $bar.lstrip(w)

Str.replace(oldv, newv, maxv=None)

Replace occurrences of a string with a new string, optionally restricting the number of replacements.

Example:

Replace instances of the string “bar” with the string “baz”:

$foo.replace('bar', 'baz')

Str.rjust(size)

No doc for Str.rjust

Str.rstrip(chars=None)

Remove trailing characters from a string.

Args:
chars (str): A list of characters to remove. If not specified, whitespace is stripped.
Examples:

Removing whitespace and specific characters:

$strippedFoo = $foo.rstrip()
$strippedBar = $bar.rstrip(asdf)

Str.split(text)

Split the string into multiple parts based on a separator.

Example:

($foo, $bar) = $baz.split(“:”)

Str.startswith(text)

No doc for Str.startswith

Str.strip(chars=None)

Remove leading and trailing characters from a string.

Args:
chars (str): A list of characters to remove. If not specified, whitespace is stripped.
Examples:

Removing whitespace and specific characters:

$strippedFoo = $foo.strip()
$strippedBar = $bar.strip(asdf)

Text

A mutable text type for simple text construction.

Text.add(text, **kwargs)

No doc for Text.add

Text.str()

No doc for Text.str

Trace

Storm API wrapper for the Path Trace object.

Trace.idens()

No doc for Trace.idens

Trigger

No doc for Trigger

Trigger.set(name, valu)

No doc for Trigger.set

User

No doc for User

User.addRule(rule, gateiden=None)

No doc for User.addRule

User.allowed(permname, gateiden=None)

No doc for User.allowed

User.delRule(rule, gateiden=None)

No doc for User.delRule

User.get(name)

No doc for User.get

User.grant(iden)

No doc for User.grant

User.iden

Constant representing the user iden.

Returns:
str: The user iden.

User.revoke(iden)

No doc for User.revoke

User.roles()

No doc for User.roles

User.setAdmin(admin, gateiden=None)

No doc for User.setAdmin

User.setEmail(email)

No doc for User.setEmail

User.setLocked(locked)

No doc for User.setLocked

User.setPasswd(passwd)

No doc for User.setPasswd

User.setRules(rules, gateiden=None)

No doc for User.setRules

View

Implements the STORM api for a view instance.

View.addNodeEdits(edits)

No doc for View.addNodeEdits

View.fork(name=None)

Fork a view in the cortex.

View.get(name, defv=None)

No doc for View.get

View.getEdgeVerbs()

No doc for View.getEdgeVerbs

View.getEdges(verb=None)

No doc for View.getEdges

View.getFormCounts()

Get the formcounts for the View.

Example:

Get the formcounts for the current View:

$counts = $lib.view.get().getFormCounts()
Returns:
Dictionary containing form names and the count of the nodes in the View’s Layers.

View.merge()

Merge a forked view back into its parent.

View.pack()

No doc for View.pack

View.repr()

No doc for View.repr

View.set(name, valu)

No doc for View.set