Learn R Programming

RStorm (version 1.0)

GetHashNames: Function to retrieve the names of locally stored objects in the stream.

Description

Function retrieves from an RStorm result object (after running a stream) all the names of all items stored in during the stream (using SetHash) as a list.

Usage

GetHashNames(object)

Arguments

object

a RStorm result object

Value

a list containing all names stored using SetHash during a stream.

See Also

See Also: SetHash, GetHash, GetHashNames

Examples

Run this code
# NOT RUN {
	# Create a topology
	topology <- Topology(data.frame(x=rnorm(100,0,1)))

	# Create two bolts and add them to the topology
	computeSum <- function(x, ...){
		sum <- GetHash("sum")
		if(is.data.frame(sum)){
			x <- sum + (x[1])
		}
		SetHash("sum", x)
	}
	computeSumSquared <- function(x, ...){
		sum2 <- GetHash("sum2")
		if(is.data.frame(sum2)){
			x <- sum2 + (x[1]^2)
		}
		SetHash("sum2", x)
	}
	topology <- AddBolt(topology, Bolt(computeSum))
	topology <- AddBolt(topology, Bolt(computeSumSquared))

	# Run the stream
	result <- RStorm(topology)

	# Get the names of all the stored objects during the stream
	print(GetHashNames(result))


# }

Run the code above in your browser using DataLab