walk

package
v0.0.0-...-160d89c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllP

func AllP(v types.Value, vr types.ValueReader, cb AllCallback, concurrency int)

AllP recursively walks over all types.Values reachable from r and calls cb on them. If |concurrency| > 1, it is the callers responsibility to make ensure that |cb| is threadsafe.

func SomeChunksP

func SomeChunksP(r types.Ref, bs types.BatchStore, stopCb SomeChunksStopCallback, chunkCb SomeChunksChunkCallback, concurrency int)

SomeChunksP invokes callbacks on every unique chunk reachable from |r| in top-down order. Callbacks are invoked only once for each chunk regardless of how many times the chunk appears.

|stopCb| is invoked for the types.Ref of every chunk. It can return true to stop SomeChunksP from descending any further. |chunkCb| is optional, invoked with the chunks.Chunk referenced by |stopCb| if it didn't return true.

func SomeP

func SomeP(v types.Value, vr types.ValueReader, cb SomeCallback, concurrency int)

SomeP recursively walks over all types.Values reachable from r and calls cb on them. If cb ever returns true, the walk will stop recursing on the current ref. If |concurrency| > 1, it is the callers responsibility to make ensure that |cb| is threadsafe.

Types

type AllCallback

type AllCallback func(v types.Value, r *types.Ref)

AllCallback takes a types.Value and processes it. If |v| is a top-level value in a Chunk, then |r| will be the Ref which referenced it (otherwise |r| is nil).

type SomeCallback

type SomeCallback func(v types.Value, r *types.Ref) bool

SomeCallback takes a types.Value and returns a bool indicating whether the current walk should skip the tree descending from value. If |v| is a top-level value in a Chunk, then |r| will be the Ref which referenced it (otherwise |r| is nil).

type SomeChunksChunkCallback

type SomeChunksChunkCallback func(r types.Ref, c chunks.Chunk)

SomeChunksChunkCallback is called for every unique chunks.Chunk |c| which wasn't stopped from SomeChunksStopCallback. |r| is a types.Ref referring to |c|.

type SomeChunksStopCallback

type SomeChunksStopCallback func(r types.Ref) bool

SomeChunksStopCallback is called for every unique types.Ref |r|. Return true to stop walking beyond |r|.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL