Home Manual Reference Source Repository
import SplitSnapshotProvider from 'snapshot-utils/lib/SplitSnapshotProvider.js'
public class | source

SplitSnapshotProvider

An implementation of working directly with snapshot data, not meant for dev consumption. This implementation uses Synchronous file APIs

Static Method Summary

Static Public Methods
public static

fromDirectory(outdir: string, callback: function(err: *, provider: SplitSnapshotProvider)): undefined

Convenience method for loading snapshot data from a directory

public static

fromStream(stream: Stream, callback: function(err: *, provider: SplitSnapshotProvider)): undefined

Convenience method for loading snapshot data from a stream

Constructor Summary

Public Constructor
public

constructor(snapshot_info: Object, node_buffer: Buffer, edge_buffer: Buffer, string_indices_buffer: Buffer, string_buffer: Buffer)

Method Summary

Public Methods
public

Get total number of Edges

public

getEdgeBuffer(index: number): Buffer

Get the buffer for an Edge at the specified index

public
public

Get total number of Nodes

public

getNodeBuffer(index: number): Buffer

Get the buffer for a Node at the specified index

public

Get total number of Samples

public

Gets a sample at the specified index.

public

Gets a string at the specified index.

public

writeToDirectory(outdir: string, callback: function(err: *)): undefined

Convenience method for saving snapshot data in a faster loading format to a directory

Static Public Methods

public static fromDirectory(outdir: string, callback: function(err: *, provider: SplitSnapshotProvider)): undefined source

Convenience method for loading snapshot data from a directory

Params:

NameTypeAttributeDescription
outdir string

Path of the directory to load

callback function(err: *, provider: SplitSnapshotProvider)

Callback notified when there is an error or completion

Return:

undefined

public static fromStream(stream: Stream, callback: function(err: *, provider: SplitSnapshotProvider)): undefined source

Convenience method for loading snapshot data from a stream

Params:

NameTypeAttributeDescription
stream Stream

Path of the directory to load

callback function(err: *, provider: SplitSnapshotProvider)

Callback notified when there is an error or completion

Return:

undefined

Public Constructors

public constructor(snapshot_info: Object, node_buffer: Buffer, edge_buffer: Buffer, string_indices_buffer: Buffer, string_buffer: Buffer) source

Params:

NameTypeAttributeDescription
snapshot_info Object

Meta information required for understanding a snapshot

node_buffer Buffer
edge_buffer Buffer
string_indices_buffer Buffer
string_buffer Buffer

Public Methods

public getEdgeArraySize(): number source

Get total number of Edges

Return:

number

public getEdgeBuffer(index: number): Buffer source

Get the buffer for an Edge at the specified index

Params:

NameTypeAttributeDescription
index number

Return:

Buffer

public getMeta(): Object source

Return:

Object

Metadata from the snapshot data required to find Node and Field structure.

public getNodeArraySize(): number source

Get total number of Nodes

Return:

number

public getNodeBuffer(index: number): Buffer source

Get the buffer for a Node at the specified index

Params:

NameTypeAttributeDescription
index number

Return:

Buffer

public getSampleArraySize(): number source

Get total number of Samples

Return:

number

public getSampleBuffer(index: number): string source

Gets a sample at the specified index.

Params:

NameTypeAttributeDescription
index number

Index of the sample we wish to get.

Return:

string

public getString(index: number): string source

Gets a string at the specified index.

Params:

NameTypeAttributeDescription
index number

Index of the string we wish to get.

Return:

string

public writeToDirectory(outdir: string, callback: function(err: *)): undefined source

Convenience method for saving snapshot data in a faster loading format to a directory

Params:

NameTypeAttributeDescription
outdir string

Path of the directory to save to

callback function(err: *)

Callback notified when there is an error or completion

Return:

undefined