filewriter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 16 Imported by: 0

README

File Export Plugin

Write block data to files. This plugin works with the file rerader plugin to create a simple file-based pipeine.

Configuration

name: "file_writer"
config:
    # BlocksDir is the path to a directory where block data should be stored.
    # The directory is created if it doesn't exist. If no directory is provided
    # blocks are written to the Conduit data directory.
    #block-dir: "/path/to/block/files"
  
    # FilenamePattern is the format used to write block files. It uses go
    # string formatting and should accept one number for the round.
    # If the file has a '.gz' extension, blocks will be gzipped.
    # Default: "%[1]d_block.json"
    filename-pattern: "%[1]d_block.json"
  
    # DropCertificate is used to remove the vote certificate from the block data before writing files.
    drop-certificate: true

Documentation

Index

Constants

View Source
const (
	// PluginName to use when configuring.
	PluginName = "file_writer"
	// FilePattern is used to name the output files.
	FilePattern = "%[1]d_block.json"
)

Variables

This section is empty.

Functions

func DecodeJSONFromFile

func DecodeJSONFromFile(filename string, v interface{}, strict bool) error

DecodeJSONFromFile is used to decode a file to an object.

func EncodeJSONToFile

func EncodeJSONToFile(filename string, v interface{}, pretty bool) error

EncodeJSONToFile is used to encode an object to a file. If the file ends in .gz it will be gzipped.

Types

type Config

type Config struct {
	/* <code>blocks-dir</code> is an optional path to a directory where block data should be
	stored.<br/>
	The directory is created if it doesn't exist.<br/>
	If no directory is provided the default plugin data directory is used.
	*/
	BlocksDir string `yaml:"block-dir"`
	/* <code>filename-pattern</code> is the format used to write block files. It uses go
	string formatting and should accept one number for the round.<br/>
	If the file has a '.gz' extension, blocks will be gzipped.
	Default:

		"%[1]d_block.json"
	*/
	FilenamePattern string `yaml:"filename-pattern"`
	// <code>drop-certificate</code> is used to remove the vote certificate from the block data before writing files.
	DropCertificate bool `yaml:"drop-certificate"`
}

Config specific to the file exporter

Jump to

Keyboard shortcuts

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