Documentation ¶
Index ¶
- Constants
- func DecodeFromFile(filename string, v interface{}, format EncodingFormat, isGzip bool) error
- func Encode(format EncodingFormat, writer io.Writer, v interface{}) error
- func EncodeToFile(filename string, v interface{}, format EncodingFormat, isGzip bool) error
- type Config
- type EncodingFormat
Constants ¶
View Source
const ( // PluginName to use when configuring. PluginName = "file_writer" // FilePattern is used to name the output files. FilePattern = "%[1]d_block.msgp.gz" // GenesisFilename is the name of the genesis file. GenesisFilename = "genesis.json" )
Variables ¶
This section is empty.
Functions ¶
func DecodeFromFile ¶ added in v1.4.0
func DecodeFromFile(filename string, v interface{}, format EncodingFormat, isGzip bool) error
DecodeFromFile decodes a file to an object using a given format and possible gzip compression.
func Encode ¶ added in v1.4.0
func Encode(format EncodingFormat, writer io.Writer, v interface{}) error
Encode an object to a writer using a given an EncodingFormat.
func EncodeToFile ¶ added in v1.4.0
func EncodeToFile(filename string, v interface{}, format EncodingFormat, isGzip bool) error
EncodeToFile encodes an object to a file using a given format and possible gzip compression.
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
type EncodingFormat ¶ added in v1.4.0
type EncodingFormat byte
EncodingFormat enumerates the acceptable encoding formats for Conduit file-based plugins.
const ( // MessagepackFormat indicates the file is encoded using MessagePack. MessagepackFormat EncodingFormat = iota // JSONFormat indicates the file is encoded using JSON. JSONFormat // UnrecognizedFormat indicates the file's encoding is unknown to Conduit. UnrecognizedFormat )
func ParseFilenamePattern ¶ added in v1.4.0
func ParseFilenamePattern(pattern string) (EncodingFormat, bool, error)
ParseFilenamePattern parses a filename pattern into an EncodingFormat and gzip flag.
Click to show internal directories.
Click to hide internal directories.