SetHash: Function to store a 'data.frame' during a stream.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hashmap.R

Description

Within bolts in used in a RStorm the GetHash and SetHash functions can be used to access a local store (or hashmap) during the stream. This corresponds to the ability of tracking parameters over the stream using a hashmap or database system as implemented in production streaming software.

Usage

1

Arguments

name

a string containing the name of the stored object

data

a data.frame (or scalar) to be stored

...

Value

If storing the value is successful returns TRUE.

Author(s)

Maurits Kaptein

See Also

See Also: TrackRow, SetHash, GetHash, GetTrack

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
topology <- Topology(data.frame(x=rnorm(100,0,1)))
computeSum <- function(x, ...){
	sum <- GetHash("sum")
	if(is.data.frame(sum)){
		x <- sum + (x[1])
	}
	SetHash("sum", x)
}
topology <- AddBolt(topology, Bolt(computeSum))
result <- RStorm(topology)
print(GetHash("sum", result))

RStorm documentation built on May 2, 2019, 9:14 a.m.

Related to SetHash in RStorm...