repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
hyperledger/burrow
vent/service/consumer.go
Health
func (c *Consumer) Health() error { if c.Closing { return errors.New("closing service") } // check db status if c.DB == nil { return errors.New("database disconnected") } if err := c.DB.Ping(); err != nil { return errors.New("database unavailable") } // check grpc connection status if c.GRPCConnection...
go
func (c *Consumer) Health() error { if c.Closing { return errors.New("closing service") } // check db status if c.DB == nil { return errors.New("database disconnected") } if err := c.DB.Ping(); err != nil { return errors.New("database unavailable") } // check grpc connection status if c.GRPCConnection...
[ "func", "(", "c", "*", "Consumer", ")", "Health", "(", ")", "error", "{", "if", "c", ".", "Closing", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// check db status", "if", "c", ".", "DB", "==", "nil", "{", "retu...
// Health returns the health status for the consumer
[ "Health", "returns", "the", "health", "status", "for", "the", "consumer" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/service/consumer.go#L320-L344
train
hyperledger/burrow
vent/service/consumer.go
Shutdown
func (c *Consumer) Shutdown() { c.Log.Info("msg", "Shutting down vent consumer...") c.Closing = true c.GRPCConnection.Close() }
go
func (c *Consumer) Shutdown() { c.Log.Info("msg", "Shutting down vent consumer...") c.Closing = true c.GRPCConnection.Close() }
[ "func", "(", "c", "*", "Consumer", ")", "Shutdown", "(", ")", "{", "c", ".", "Log", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "c", ".", "Closing", "=", "true", "\n", "c", ".", "GRPCConnection", ".", "Close", "(", ")", "\n", "}...
// Shutdown gracefully shuts down the events consumer
[ "Shutdown", "gracefully", "shuts", "down", "the", "events", "consumer" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/service/consumer.go#L347-L351
train
hyperledger/burrow
vent/sqlsol/block_data.go
NewBlockData
func NewBlockData(height uint64) *BlockData { data := types.EventData{ Tables: make(map[string]types.EventDataTable), BlockHeight: height, } return &BlockData{ Data: data, } }
go
func NewBlockData(height uint64) *BlockData { data := types.EventData{ Tables: make(map[string]types.EventDataTable), BlockHeight: height, } return &BlockData{ Data: data, } }
[ "func", "NewBlockData", "(", "height", "uint64", ")", "*", "BlockData", "{", "data", ":=", "types", ".", "EventData", "{", "Tables", ":", "make", "(", "map", "[", "string", "]", "types", ".", "EventDataTable", ")", ",", "BlockHeight", ":", "height", ",",...
// NewBlockData returns a pointer to an empty BlockData structure
[ "NewBlockData", "returns", "a", "pointer", "to", "an", "empty", "BlockData", "structure" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/block_data.go#L15-L24
train
hyperledger/burrow
vent/sqlsol/block_data.go
AddRow
func (b *BlockData) AddRow(tableName string, row types.EventDataRow) { if _, ok := b.Data.Tables[tableName]; !ok { b.Data.Tables[tableName] = types.EventDataTable{} } b.Data.Tables[tableName] = append(b.Data.Tables[tableName], row) }
go
func (b *BlockData) AddRow(tableName string, row types.EventDataRow) { if _, ok := b.Data.Tables[tableName]; !ok { b.Data.Tables[tableName] = types.EventDataTable{} } b.Data.Tables[tableName] = append(b.Data.Tables[tableName], row) }
[ "func", "(", "b", "*", "BlockData", ")", "AddRow", "(", "tableName", "string", ",", "row", "types", ".", "EventDataRow", ")", "{", "if", "_", ",", "ok", ":=", "b", ".", "Data", ".", "Tables", "[", "tableName", "]", ";", "!", "ok", "{", "b", ".", ...
// AddRow appends a row to a specific table name in structure
[ "AddRow", "appends", "a", "row", "to", "a", "specific", "table", "name", "in", "structure" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/block_data.go#L27-L32
train
hyperledger/burrow
vent/sqlsol/block_data.go
GetRows
func (b *BlockData) GetRows(tableName string) (types.EventDataTable, error) { if table, ok := b.Data.Tables[tableName]; ok { return table, nil } return nil, fmt.Errorf("GetRows: tableName does not exists as a table in data structure: %s ", tableName) }
go
func (b *BlockData) GetRows(tableName string) (types.EventDataTable, error) { if table, ok := b.Data.Tables[tableName]; ok { return table, nil } return nil, fmt.Errorf("GetRows: tableName does not exists as a table in data structure: %s ", tableName) }
[ "func", "(", "b", "*", "BlockData", ")", "GetRows", "(", "tableName", "string", ")", "(", "types", ".", "EventDataTable", ",", "error", ")", "{", "if", "table", ",", "ok", ":=", "b", ".", "Data", ".", "Tables", "[", "tableName", "]", ";", "ok", "{"...
// GetRows gets data rows for a given table name from structure
[ "GetRows", "gets", "data", "rows", "for", "a", "given", "table", "name", "from", "structure" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/block_data.go#L35-L40
train
hyperledger/burrow
vent/sqlsol/block_data.go
PendingRows
func (b *BlockData) PendingRows(height uint64) bool { hasRows := false // TODO: understand why the guard on height is needed - what does it prevent? if b.Data.BlockHeight == height && len(b.Data.Tables) > 0 { hasRows = true } return hasRows }
go
func (b *BlockData) PendingRows(height uint64) bool { hasRows := false // TODO: understand why the guard on height is needed - what does it prevent? if b.Data.BlockHeight == height && len(b.Data.Tables) > 0 { hasRows = true } return hasRows }
[ "func", "(", "b", "*", "BlockData", ")", "PendingRows", "(", "height", "uint64", ")", "bool", "{", "hasRows", ":=", "false", "\n", "// TODO: understand why the guard on height is needed - what does it prevent?", "if", "b", ".", "Data", ".", "BlockHeight", "==", "hei...
// PendingRows returns true if the given block has at least one pending row to upsert
[ "PendingRows", "returns", "true", "if", "the", "given", "block", "has", "at", "least", "one", "pending", "row", "to", "upsert" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/block_data.go#L43-L50
train
hyperledger/burrow
execution/evm/memory.go
NewDynamicMemory
func NewDynamicMemory(initialCapacity, maximumCapacity uint64, errSink errors.Sink) Memory { return &dynamicMemory{ slice: make([]byte, initialCapacity), maximumCapacity: maximumCapacity, errSink: errSink, } }
go
func NewDynamicMemory(initialCapacity, maximumCapacity uint64, errSink errors.Sink) Memory { return &dynamicMemory{ slice: make([]byte, initialCapacity), maximumCapacity: maximumCapacity, errSink: errSink, } }
[ "func", "NewDynamicMemory", "(", "initialCapacity", ",", "maximumCapacity", "uint64", ",", "errSink", "errors", ".", "Sink", ")", "Memory", "{", "return", "&", "dynamicMemory", "{", "slice", ":", "make", "(", "[", "]", "byte", ",", "initialCapacity", ")", ",...
// Get a new DynamicMemory (note that although we take a maximumCapacity of uint64 we currently // limit the maximum to int32 at runtime because we are using a single slice which we cannot guarantee // to be indexable above int32 or all validators
[ "Get", "a", "new", "DynamicMemory", "(", "note", "that", "although", "we", "take", "a", "maximumCapacity", "of", "uint64", "we", "currently", "limit", "the", "maximum", "to", "int32", "at", "runtime", "because", "we", "are", "using", "a", "single", "slice", ...
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/memory.go#L48-L54
train
hyperledger/burrow
execution/simulated_call.go
CallSim
func CallSim(reader acmstate.Reader, tip bcm.BlockchainInfo, fromAddress, address crypto.Address, data []byte, logger *logging.Logger) (*exec.TxExecution, error) { cache := acmstate.NewCache(reader) exe := contexts.CallContext{ RunCall: true, StateWriter: cache, Blockchain: tip, Logger: logger, }...
go
func CallSim(reader acmstate.Reader, tip bcm.BlockchainInfo, fromAddress, address crypto.Address, data []byte, logger *logging.Logger) (*exec.TxExecution, error) { cache := acmstate.NewCache(reader) exe := contexts.CallContext{ RunCall: true, StateWriter: cache, Blockchain: tip, Logger: logger, }...
[ "func", "CallSim", "(", "reader", "acmstate", ".", "Reader", ",", "tip", "bcm", ".", "BlockchainInfo", ",", "fromAddress", ",", "address", "crypto", ".", "Address", ",", "data", "[", "]", "byte", ",", "logger", "*", "logging", ".", "Logger", ")", "(", ...
// Run a contract's code on an isolated and unpersisted state // Cannot be used to create new contracts
[ "Run", "a", "contract", "s", "code", "on", "an", "isolated", "and", "unpersisted", "state", "Cannot", "be", "used", "to", "create", "new", "contracts" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/simulated_call.go#L17-L41
train
hyperledger/burrow
execution/simulated_call.go
CallCodeSim
func CallCodeSim(reader acmstate.Reader, tip bcm.BlockchainInfo, fromAddress, address crypto.Address, code, data []byte, logger *logging.Logger) (*exec.TxExecution, error) { // Attach code to target account (overwriting target) cache := acmstate.NewCache(reader) err := cache.UpdateAccount(&acm.Account{ Address: ...
go
func CallCodeSim(reader acmstate.Reader, tip bcm.BlockchainInfo, fromAddress, address crypto.Address, code, data []byte, logger *logging.Logger) (*exec.TxExecution, error) { // Attach code to target account (overwriting target) cache := acmstate.NewCache(reader) err := cache.UpdateAccount(&acm.Account{ Address: ...
[ "func", "CallCodeSim", "(", "reader", "acmstate", ".", "Reader", ",", "tip", "bcm", ".", "BlockchainInfo", ",", "fromAddress", ",", "address", "crypto", ".", "Address", ",", "code", ",", "data", "[", "]", "byte", ",", "logger", "*", "logging", ".", "Logg...
// Run the given code on an isolated and unpersisted state // Cannot be used to create new contracts.
[ "Run", "the", "given", "code", "on", "an", "isolated", "and", "unpersisted", "state", "Cannot", "be", "used", "to", "create", "new", "contracts", "." ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/simulated_call.go#L45-L59
train
hyperledger/burrow
core/config.go
LoadKeysFromConfig
func (kern *Kernel) LoadKeysFromConfig(conf *keys.KeysConfig) (err error) { kern.keyStore = keys.NewKeyStore(conf.KeysDirectory, conf.AllowBadFilePermissions) if conf.RemoteAddress != "" { kern.keyClient, err = keys.NewRemoteKeyClient(conf.RemoteAddress, kern.Logger) if err != nil { return err } } else { ...
go
func (kern *Kernel) LoadKeysFromConfig(conf *keys.KeysConfig) (err error) { kern.keyStore = keys.NewKeyStore(conf.KeysDirectory, conf.AllowBadFilePermissions) if conf.RemoteAddress != "" { kern.keyClient, err = keys.NewRemoteKeyClient(conf.RemoteAddress, kern.Logger) if err != nil { return err } } else { ...
[ "func", "(", "kern", "*", "Kernel", ")", "LoadKeysFromConfig", "(", "conf", "*", "keys", ".", "KeysConfig", ")", "(", "err", "error", ")", "{", "kern", ".", "keyStore", "=", "keys", ".", "NewKeyStore", "(", "conf", ".", "KeysDirectory", ",", "conf", "....
// LoadKeysFromConfig sets the keyClient & keyStore based on the given config
[ "LoadKeysFromConfig", "sets", "the", "keyClient", "&", "keyStore", "based", "on", "the", "given", "config" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/config.go#L23-L34
train
hyperledger/burrow
core/config.go
LoadLoggerFromConfig
func (kern *Kernel) LoadLoggerFromConfig(conf *logconfig.LoggingConfig) error { logger, err := lifecycle.NewLoggerFromLoggingConfig(conf) kern.SetLogger(logger) return err }
go
func (kern *Kernel) LoadLoggerFromConfig(conf *logconfig.LoggingConfig) error { logger, err := lifecycle.NewLoggerFromLoggingConfig(conf) kern.SetLogger(logger) return err }
[ "func", "(", "kern", "*", "Kernel", ")", "LoadLoggerFromConfig", "(", "conf", "*", "logconfig", ".", "LoggingConfig", ")", "error", "{", "logger", ",", "err", ":=", "lifecycle", ".", "NewLoggerFromLoggingConfig", "(", "conf", ")", "\n", "kern", ".", "SetLogg...
// LoadLoggerFromConfig adds a logging configuration to the kernel
[ "LoadLoggerFromConfig", "adds", "a", "logging", "configuration", "to", "the", "kernel" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/config.go#L37-L41
train
hyperledger/burrow
core/config.go
LoadExecutionOptionsFromConfig
func (kern *Kernel) LoadExecutionOptionsFromConfig(conf *execution.ExecutionConfig) error { if conf != nil { exeOptions, err := conf.ExecutionOptions() if err != nil { return err } kern.exeOptions = exeOptions kern.timeoutFactor = conf.TimeoutFactor } return nil }
go
func (kern *Kernel) LoadExecutionOptionsFromConfig(conf *execution.ExecutionConfig) error { if conf != nil { exeOptions, err := conf.ExecutionOptions() if err != nil { return err } kern.exeOptions = exeOptions kern.timeoutFactor = conf.TimeoutFactor } return nil }
[ "func", "(", "kern", "*", "Kernel", ")", "LoadExecutionOptionsFromConfig", "(", "conf", "*", "execution", ".", "ExecutionConfig", ")", "error", "{", "if", "conf", "!=", "nil", "{", "exeOptions", ",", "err", ":=", "conf", ".", "ExecutionOptions", "(", ")", ...
// LoadExecutionOptionsFromConfig builds the execution options for the kernel
[ "LoadExecutionOptionsFromConfig", "builds", "the", "execution", "options", "for", "the", "kernel" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/config.go#L44-L54
train
hyperledger/burrow
core/config.go
LoadTendermintFromConfig
func (kern *Kernel) LoadTendermintFromConfig(conf *config.BurrowConfig, privVal tmTypes.PrivValidator) (err error) { if conf.Tendermint == nil || !conf.Tendermint.Enabled { return nil } authorizedPeersProvider := conf.Tendermint.DefaultAuthorizedPeersProvider() kern.database.Stats() kern.info = fmt.Sprintf("Bu...
go
func (kern *Kernel) LoadTendermintFromConfig(conf *config.BurrowConfig, privVal tmTypes.PrivValidator) (err error) { if conf.Tendermint == nil || !conf.Tendermint.Enabled { return nil } authorizedPeersProvider := conf.Tendermint.DefaultAuthorizedPeersProvider() kern.database.Stats() kern.info = fmt.Sprintf("Bu...
[ "func", "(", "kern", "*", "Kernel", ")", "LoadTendermintFromConfig", "(", "conf", "*", "config", ".", "BurrowConfig", ",", "privVal", "tmTypes", ".", "PrivValidator", ")", "(", "err", "error", ")", "{", "if", "conf", ".", "Tendermint", "==", "nil", "||", ...
// LoadTendermintFromConfig loads our consensus engine into the kernel
[ "LoadTendermintFromConfig", "loads", "our", "consensus", "engine", "into", "the", "kernel" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/config.go#L57-L101
train
hyperledger/burrow
core/config.go
LoadKernelFromConfig
func LoadKernelFromConfig(conf *config.BurrowConfig) (*Kernel, error) { kern, err := NewKernel(conf.BurrowDir) if err != nil { return nil, fmt.Errorf("could not create initial kernel: %v", err) } if err = kern.LoadLoggerFromConfig(conf.Logging); err != nil { return nil, fmt.Errorf("could not configure logger: ...
go
func LoadKernelFromConfig(conf *config.BurrowConfig) (*Kernel, error) { kern, err := NewKernel(conf.BurrowDir) if err != nil { return nil, fmt.Errorf("could not create initial kernel: %v", err) } if err = kern.LoadLoggerFromConfig(conf.Logging); err != nil { return nil, fmt.Errorf("could not configure logger: ...
[ "func", "LoadKernelFromConfig", "(", "conf", "*", "config", ".", "BurrowConfig", ")", "(", "*", "Kernel", ",", "error", ")", "{", "kern", ",", "err", ":=", "NewKernel", "(", "conf", ".", "BurrowDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// LoadKernelFromConfig builds and returns a Kernel based solely on the supplied configuration
[ "LoadKernelFromConfig", "builds", "and", "returns", "a", "Kernel", "based", "solely", "on", "the", "supplied", "configuration" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/config.go#L104-L145
train
hyperledger/burrow
binary/integer.go
U256
func U256(x *big.Int) *big.Int { // Note that the And operation induces big.Int to hold a positive representation of a negative number return new(big.Int).And(x, tt256m1) }
go
func U256(x *big.Int) *big.Int { // Note that the And operation induces big.Int to hold a positive representation of a negative number return new(big.Int).And(x, tt256m1) }
[ "func", "U256", "(", "x", "*", "big", ".", "Int", ")", "*", "big", ".", "Int", "{", "// Note that the And operation induces big.Int to hold a positive representation of a negative number", "return", "new", "(", "big", ".", "Int", ")", ".", "And", "(", "x", ",", ...
// Converts a possibly negative big int x into a positive big int encoding a twos complement representation of x // truncated to 32 bytes
[ "Converts", "a", "possibly", "negative", "big", "int", "x", "into", "a", "positive", "big", "int", "encoding", "a", "twos", "complement", "representation", "of", "x", "truncated", "to", "32", "bytes" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/binary/integer.go#L70-L73
train
hyperledger/burrow
binary/integer.go
SignExtend
func SignExtend(back uint64, x *big.Int) *big.Int { // we assume x contains a signed integer of back + 1 bytes width // most significant bit of the back'th byte, signBit := back*8 + 7 // single bit set at sign bit position mask := new(big.Int).Lsh(big1, uint(signBit)) // all bits below sign bit set to 1 all above...
go
func SignExtend(back uint64, x *big.Int) *big.Int { // we assume x contains a signed integer of back + 1 bytes width // most significant bit of the back'th byte, signBit := back*8 + 7 // single bit set at sign bit position mask := new(big.Int).Lsh(big1, uint(signBit)) // all bits below sign bit set to 1 all above...
[ "func", "SignExtend", "(", "back", "uint64", ",", "x", "*", "big", ".", "Int", ")", "*", "big", ".", "Int", "{", "// we assume x contains a signed integer of back + 1 bytes width", "// most significant bit of the back'th byte,", "signBit", ":=", "back", "*", "8", "+",...
// Treats the positive big int x as if it contains an embedded a back + 1 byte signed integer in its least significant // bits and extends that sign
[ "Treats", "the", "positive", "big", "int", "x", "as", "if", "it", "contains", "an", "embedded", "a", "back", "+", "1", "byte", "signed", "integer", "in", "its", "least", "significant", "bits", "and", "extends", "that", "sign" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/binary/integer.go#L88-L103
train
hyperledger/burrow
keys/key_client.go
HealthCheck
func (l *remoteKeyClient) HealthCheck() error { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() _, err := l.kc.List(ctx, &ListRequest{}) return err }
go
func (l *remoteKeyClient) HealthCheck() error { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() _, err := l.kc.List(ctx, &ListRequest{}) return err }
[ "func", "(", "l", "*", "remoteKeyClient", ")", "HealthCheck", "(", ")", "error", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "10", "*", "time", ".", "Second", ")", "\n", "defer", "...
// HealthCheck returns nil if the keys instance is healthy, error otherwise
[ "HealthCheck", "returns", "nil", "if", "the", "keys", "instance", "is", "healthy", "error", "otherwise" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/keys/key_client.go#L177-L182
train
hyperledger/burrow
keys/key_client.go
NewRemoteKeyClient
func NewRemoteKeyClient(rpcAddress string, logger *logging.Logger) (KeyClient, error) { logger = logger.WithScope("RemoteKeyClient") var opts []grpc.DialOption opts = append(opts, grpc.WithInsecure()) conn, err := grpc.Dial(rpcAddress, opts...) if err != nil { return nil, err } kc := NewKeysClient(conn) retu...
go
func NewRemoteKeyClient(rpcAddress string, logger *logging.Logger) (KeyClient, error) { logger = logger.WithScope("RemoteKeyClient") var opts []grpc.DialOption opts = append(opts, grpc.WithInsecure()) conn, err := grpc.Dial(rpcAddress, opts...) if err != nil { return nil, err } kc := NewKeysClient(conn) retu...
[ "func", "NewRemoteKeyClient", "(", "rpcAddress", "string", ",", "logger", "*", "logging", ".", "Logger", ")", "(", "KeyClient", ",", "error", ")", "{", "logger", "=", "logger", ".", "WithScope", "(", "\"", "\"", ")", "\n", "var", "opts", "[", "]", "grp...
// NewRemoteKeyClient returns a new keys client for provided rpc location
[ "NewRemoteKeyClient", "returns", "a", "new", "keys", "client", "for", "provided", "rpc", "location" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/keys/key_client.go#L185-L196
train
hyperledger/burrow
keys/key_client.go
NewLocalKeyClient
func NewLocalKeyClient(ks *KeyStore, logger *logging.Logger) KeyClient { logger = logger.WithScope("LocalKeyClient") return &localKeyClient{ks: ks, logger: logger} }
go
func NewLocalKeyClient(ks *KeyStore, logger *logging.Logger) KeyClient { logger = logger.WithScope("LocalKeyClient") return &localKeyClient{ks: ks, logger: logger} }
[ "func", "NewLocalKeyClient", "(", "ks", "*", "KeyStore", ",", "logger", "*", "logging", ".", "Logger", ")", "KeyClient", "{", "logger", "=", "logger", ".", "WithScope", "(", "\"", "\"", ")", "\n", "return", "&", "localKeyClient", "{", "ks", ":", "ks", ...
// NewLocalKeyClient returns a new keys client, backed by the local filesystem
[ "NewLocalKeyClient", "returns", "a", "new", "keys", "client", "backed", "by", "the", "local", "filesystem" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/keys/key_client.go#L199-L202
train
hyperledger/burrow
keys/key_client.go
AddressableSigner
func AddressableSigner(keyClient KeyClient, address crypto.Address) (*Signer, error) { publicKey, err := keyClient.PublicKey(address) if err != nil { return nil, err } // TODO: we can do better than this and return a typed signature when we reform the keys service return &Signer{ keyClient: keyClient, addres...
go
func AddressableSigner(keyClient KeyClient, address crypto.Address) (*Signer, error) { publicKey, err := keyClient.PublicKey(address) if err != nil { return nil, err } // TODO: we can do better than this and return a typed signature when we reform the keys service return &Signer{ keyClient: keyClient, addres...
[ "func", "AddressableSigner", "(", "keyClient", "KeyClient", ",", "address", "crypto", ".", "Address", ")", "(", "*", "Signer", ",", "error", ")", "{", "publicKey", ",", "err", ":=", "keyClient", ".", "PublicKey", "(", "address", ")", "\n", "if", "err", "...
// AddressableSigner creates a signer that assumes the address holds an Ed25519 key
[ "AddressableSigner", "creates", "a", "signer", "that", "assumes", "the", "address", "holds", "an", "Ed25519", "key" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/keys/key_client.go#L211-L222
train
hyperledger/burrow
vent/sqldb/adapters/sqlite_adapter.go
Open
func (adapter *SQLiteAdapter) Open(dbURL string) (*sql.DB, error) { db, err := sql.Open("sqlite3", dbURL) if err != nil { adapter.Log.Info("msg", "Error creating database connection", "err", err) return nil, err } return db, nil }
go
func (adapter *SQLiteAdapter) Open(dbURL string) (*sql.DB, error) { db, err := sql.Open("sqlite3", dbURL) if err != nil { adapter.Log.Info("msg", "Error creating database connection", "err", err) return nil, err } return db, nil }
[ "func", "(", "adapter", "*", "SQLiteAdapter", ")", "Open", "(", "dbURL", "string", ")", "(", "*", "sql", ".", "DB", ",", "error", ")", "{", "db", ",", "err", ":=", "sql", ".", "Open", "(", "\"", "\"", ",", "dbURL", ")", "\n", "if", "err", "!=",...
// Open connects to a SQLiteQL database, opens it & create default schema if provided
[ "Open", "connects", "to", "a", "SQLiteQL", "database", "opens", "it", "&", "create", "default", "schema", "if", "provided" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/sqlite_adapter.go#L42-L50
train
hyperledger/burrow
vent/sqldb/adapters/sqlite_adapter.go
AlterColumnQuery
func (adapter *SQLiteAdapter) AlterColumnQuery(tableName, columnName string, sqlColumnType types.SQLColumnType, length, order int) (string, string) { sqlType, _ := adapter.TypeMapping(sqlColumnType) if length > 0 { sqlType = Cleanf("%s(%d)", sqlType, length) } query := Cleanf("ALTER TABLE %s ADD COLUMN %s %s;", ...
go
func (adapter *SQLiteAdapter) AlterColumnQuery(tableName, columnName string, sqlColumnType types.SQLColumnType, length, order int) (string, string) { sqlType, _ := adapter.TypeMapping(sqlColumnType) if length > 0 { sqlType = Cleanf("%s(%d)", sqlType, length) } query := Cleanf("ALTER TABLE %s ADD COLUMN %s %s;", ...
[ "func", "(", "adapter", "*", "SQLiteAdapter", ")", "AlterColumnQuery", "(", "tableName", ",", "columnName", "string", ",", "sqlColumnType", "types", ".", "SQLColumnType", ",", "length", ",", "order", "int", ")", "(", "string", ",", "string", ")", "{", "sqlTy...
// AlterColumnQuery returns a query for adding a new column to a table
[ "AlterColumnQuery", "returns", "a", "query", "for", "adding", "a", "new", "column", "to", "a", "table" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/sqlite_adapter.go#L184-L208
train
hyperledger/burrow
permission/perm_flag.go
String
func (pf PermFlag) String() string { switch pf { case AllPermFlags: return AllString case Root: return RootString case Send: return SendString case Call: return CallString case CreateContract: return CreateContractString case CreateAccount: return CreateAccountString case Bond: return BondString ...
go
func (pf PermFlag) String() string { switch pf { case AllPermFlags: return AllString case Root: return RootString case Send: return SendString case Call: return CallString case CreateContract: return CreateContractString case CreateAccount: return CreateAccountString case Bond: return BondString ...
[ "func", "(", "pf", "PermFlag", ")", "String", "(", ")", "string", "{", "switch", "pf", "{", "case", "AllPermFlags", ":", "return", "AllString", "\n", "case", "Root", ":", "return", "RootString", "\n", "case", "Send", ":", "return", "SendString", "\n", "c...
// Returns the string name of a single bit non-composite PermFlag, or otherwise UnknownString // See BasePermissionsToStringList to generate a string representation of a composite PermFlag
[ "Returns", "the", "string", "name", "of", "a", "single", "bit", "non", "-", "composite", "PermFlag", "or", "otherwise", "UnknownString", "See", "BasePermissionsToStringList", "to", "generate", "a", "string", "representation", "of", "a", "composite", "PermFlag" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/perm_flag.go#L95-L136
train
hyperledger/burrow
permission/perm_flag.go
PermStringToFlag
func PermStringToFlag(perm string) (PermFlag, error) { switch strings.ToLower(perm) { case AllString: return AllPermFlags, nil case RootString: return Root, nil case SendString: return Send, nil case CallString: return Call, nil case CreateContractString, "createcontract", "create_contract": return Crea...
go
func PermStringToFlag(perm string) (PermFlag, error) { switch strings.ToLower(perm) { case AllString: return AllPermFlags, nil case RootString: return Root, nil case SendString: return Send, nil case CallString: return Call, nil case CreateContractString, "createcontract", "create_contract": return Crea...
[ "func", "PermStringToFlag", "(", "perm", "string", ")", "(", "PermFlag", ",", "error", ")", "{", "switch", "strings", ".", "ToLower", "(", "perm", ")", "{", "case", "AllString", ":", "return", "AllPermFlags", ",", "nil", "\n", "case", "RootString", ":", ...
// PermStringToFlag maps camel- and snake case strings to the // the corresponding permission flag.
[ "PermStringToFlag", "maps", "camel", "-", "and", "snake", "case", "strings", "to", "the", "the", "corresponding", "permission", "flag", "." ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/perm_flag.go#L140-L181
train
hyperledger/burrow
consensus/tendermint/tendermint.go
DBProvider
func (n *Node) DBProvider(ctx *node.DBContext) (dbm.DB, error) { db := DBProvider(ctx.ID, dbm.DBBackendType(ctx.Config.DBBackend), ctx.Config.DBDir()) n.closers = append(n.closers, db) return db, nil }
go
func (n *Node) DBProvider(ctx *node.DBContext) (dbm.DB, error) { db := DBProvider(ctx.ID, dbm.DBBackendType(ctx.Config.DBBackend), ctx.Config.DBDir()) n.closers = append(n.closers, db) return db, nil }
[ "func", "(", "n", "*", "Node", ")", "DBProvider", "(", "ctx", "*", "node", ".", "DBContext", ")", "(", "dbm", ".", "DB", ",", "error", ")", "{", "db", ":=", "DBProvider", "(", "ctx", ".", "ID", ",", "dbm", ".", "DBBackendType", "(", "ctx", ".", ...
// Since Tendermint doesn't close its DB connections
[ "Since", "Tendermint", "doesn", "t", "close", "its", "DB", "connections" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/consensus/tendermint/tendermint.go#L35-L39
train
hyperledger/burrow
vent/logger/logger.go
NewLogger
func NewLogger(level string) *Logger { log := kitlog.NewJSONLogger(kitlog.NewSyncWriter(os.Stdout)) switch level { case "error": log = kitlevel.NewFilter(log, kitlevel.AllowError()) // only error logs case "warn": log = kitlevel.NewFilter(log, kitlevel.AllowWarn()) // warn + error logs case "info": log = kit...
go
func NewLogger(level string) *Logger { log := kitlog.NewJSONLogger(kitlog.NewSyncWriter(os.Stdout)) switch level { case "error": log = kitlevel.NewFilter(log, kitlevel.AllowError()) // only error logs case "warn": log = kitlevel.NewFilter(log, kitlevel.AllowWarn()) // warn + error logs case "info": log = kit...
[ "func", "NewLogger", "(", "level", "string", ")", "*", "Logger", "{", "log", ":=", "kitlog", ".", "NewJSONLogger", "(", "kitlog", ".", "NewSyncWriter", "(", "os", ".", "Stdout", ")", ")", "\n", "switch", "level", "{", "case", "\"", "\"", ":", "log", ...
// NewLogger creates a new logger based on the given level
[ "NewLogger", "creates", "a", "new", "logger", "based", "on", "the", "given", "level" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/logger/logger.go#L16-L38
train
hyperledger/burrow
vent/logger/logger.go
Error
func (l *Logger) Error(args ...interface{}) { kitlevel.Error(l.Log).Log(args...) }
go
func (l *Logger) Error(args ...interface{}) { kitlevel.Error(l.Log).Log(args...) }
[ "func", "(", "l", "*", "Logger", ")", "Error", "(", "args", "...", "interface", "{", "}", ")", "{", "kitlevel", ".", "Error", "(", "l", ".", "Log", ")", ".", "Log", "(", "args", "...", ")", "\n", "}" ]
// Error prints an error log
[ "Error", "prints", "an", "error", "log" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/logger/logger.go#L48-L50
train
hyperledger/burrow
vent/logger/logger.go
Warn
func (l *Logger) Warn(args ...interface{}) { kitlevel.Warn(l.Log).Log(args...) }
go
func (l *Logger) Warn(args ...interface{}) { kitlevel.Warn(l.Log).Log(args...) }
[ "func", "(", "l", "*", "Logger", ")", "Warn", "(", "args", "...", "interface", "{", "}", ")", "{", "kitlevel", ".", "Warn", "(", "l", ".", "Log", ")", ".", "Log", "(", "args", "...", ")", "\n", "}" ]
// Warn prints a warning log
[ "Warn", "prints", "a", "warning", "log" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/logger/logger.go#L53-L55
train
hyperledger/burrow
vent/logger/logger.go
Info
func (l *Logger) Info(args ...interface{}) { kitlevel.Info(l.Log).Log(args...) }
go
func (l *Logger) Info(args ...interface{}) { kitlevel.Info(l.Log).Log(args...) }
[ "func", "(", "l", "*", "Logger", ")", "Info", "(", "args", "...", "interface", "{", "}", ")", "{", "kitlevel", ".", "Info", "(", "l", ".", "Log", ")", ".", "Log", "(", "args", "...", ")", "\n", "}" ]
// Info prints an information log
[ "Info", "prints", "an", "information", "log" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/logger/logger.go#L58-L60
train
hyperledger/burrow
vent/logger/logger.go
Debug
func (l *Logger) Debug(args ...interface{}) { kitlevel.Debug(l.Log).Log(args...) }
go
func (l *Logger) Debug(args ...interface{}) { kitlevel.Debug(l.Log).Log(args...) }
[ "func", "(", "l", "*", "Logger", ")", "Debug", "(", "args", "...", "interface", "{", "}", ")", "{", "kitlevel", ".", "Debug", "(", "l", ".", "Log", ")", ".", "Log", "(", "args", "...", ")", "\n", "}" ]
// Debug prints a debug log
[ "Debug", "prints", "a", "debug", "log" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/logger/logger.go#L63-L65
train
hyperledger/burrow
genesis/spec/template_account.go
RealisePublicKeyAndAddress
func (ta TemplateAccount) RealisePublicKeyAndAddress(keyClient keys.KeyClient) (pubKey crypto.PublicKey, address crypto.Address, err error) { if ta.PublicKey == nil { if ta.Address == nil { // If neither PublicKey or Address set then generate a new one address, err = keyClient.Generate(ta.Name, crypto.CurveTyp...
go
func (ta TemplateAccount) RealisePublicKeyAndAddress(keyClient keys.KeyClient) (pubKey crypto.PublicKey, address crypto.Address, err error) { if ta.PublicKey == nil { if ta.Address == nil { // If neither PublicKey or Address set then generate a new one address, err = keyClient.Generate(ta.Name, crypto.CurveTyp...
[ "func", "(", "ta", "TemplateAccount", ")", "RealisePublicKeyAndAddress", "(", "keyClient", "keys", ".", "KeyClient", ")", "(", "pubKey", "crypto", ".", "PublicKey", ",", "address", "crypto", ".", "Address", ",", "err", "error", ")", "{", "if", "ta", ".", "...
// Adds a public key and address to the template. If PublicKey will try to fetch it by Address. // If both PublicKey and Address are not set will use the keyClient to generate a new keypair
[ "Adds", "a", "public", "key", "and", "address", "to", "the", "template", ".", "If", "PublicKey", "will", "try", "to", "fetch", "it", "by", "Address", ".", "If", "both", "PublicKey", "and", "Address", "are", "not", "set", "will", "use", "the", "keyClient"...
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/genesis/spec/template_account.go#L81-L106
train
hyperledger/burrow
consensus/abci/execute_tx.go
ExecuteTx
func ExecuteTx(logHeader string, executor execution.Executor, txDecoder txs.Decoder, txBytes []byte) types.ResponseCheckTx { logf := func(format string, args ...interface{}) string { return fmt.Sprintf("%s: "+format, append([]interface{}{logHeader}, args...)...) } txEnv, err := txDecoder.DecodeTx(txBytes) if err...
go
func ExecuteTx(logHeader string, executor execution.Executor, txDecoder txs.Decoder, txBytes []byte) types.ResponseCheckTx { logf := func(format string, args ...interface{}) string { return fmt.Sprintf("%s: "+format, append([]interface{}{logHeader}, args...)...) } txEnv, err := txDecoder.DecodeTx(txBytes) if err...
[ "func", "ExecuteTx", "(", "logHeader", "string", ",", "executor", "execution", ".", "Executor", ",", "txDecoder", "txs", ".", "Decoder", ",", "txBytes", "[", "]", "byte", ")", "types", ".", "ResponseCheckTx", "{", "logf", ":=", "func", "(", "format", "stri...
// Attempt to execute a transaction using ABCI conventions and codes
[ "Attempt", "to", "execute", "a", "transaction", "using", "ABCI", "conventions", "and", "codes" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/consensus/abci/execute_tx.go#L17-L62
train
hyperledger/burrow
consensus/abci/execute_tx.go
WithTags
func WithTags(logger *logging.Logger, tags []common.KVPair) *logging.Logger { keyvals := make([]interface{}, len(tags)*2) for i, kvp := range tags { keyvals[i] = string(kvp.Key) keyvals[i+1] = string(kvp.Value) } return logger.With(keyvals...) }
go
func WithTags(logger *logging.Logger, tags []common.KVPair) *logging.Logger { keyvals := make([]interface{}, len(tags)*2) for i, kvp := range tags { keyvals[i] = string(kvp.Key) keyvals[i+1] = string(kvp.Value) } return logger.With(keyvals...) }
[ "func", "WithTags", "(", "logger", "*", "logging", ".", "Logger", ",", "tags", "[", "]", "common", ".", "KVPair", ")", "*", "logging", ".", "Logger", "{", "keyvals", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "tags", ")", ...
// Some ABCI type helpers
[ "Some", "ABCI", "type", "helpers" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/consensus/abci/execute_tx.go#L66-L73
train
hyperledger/burrow
rpc/lib/server/handlers.go
jsonParamsToArgsWS
func jsonParamsToArgsWS(rpcFunc *RPCFunc, params json.RawMessage, wsCtx types.WSRPCContext) ([]reflect.Value, error) { values, err := jsonParamsToArgs(rpcFunc, params, 1) if err != nil { return nil, err } return append([]reflect.Value{reflect.ValueOf(wsCtx)}, values...), nil }
go
func jsonParamsToArgsWS(rpcFunc *RPCFunc, params json.RawMessage, wsCtx types.WSRPCContext) ([]reflect.Value, error) { values, err := jsonParamsToArgs(rpcFunc, params, 1) if err != nil { return nil, err } return append([]reflect.Value{reflect.ValueOf(wsCtx)}, values...), nil }
[ "func", "jsonParamsToArgsWS", "(", "rpcFunc", "*", "RPCFunc", ",", "params", "json", ".", "RawMessage", ",", "wsCtx", "types", ".", "WSRPCContext", ")", "(", "[", "]", "reflect", ".", "Value", ",", "error", ")", "{", "values", ",", "err", ":=", "jsonPara...
// Same as above, but with the first param the websocket connection
[ "Same", "as", "above", "but", "with", "the", "first", "param", "the", "websocket", "connection" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/lib/server/handlers.go#L228-L234
train
hyperledger/burrow
rpc/lib/server/handlers.go
NewWebsocketManager
func NewWebsocketManager(funcMap map[string]*RPCFunc, logger *logging.Logger, wsConnOptions ...func(*wsConnection)) *WebsocketManager { return &WebsocketManager{ funcMap: funcMap, Upgrader: websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { // TODO ??? return true }, }, logger: ...
go
func NewWebsocketManager(funcMap map[string]*RPCFunc, logger *logging.Logger, wsConnOptions ...func(*wsConnection)) *WebsocketManager { return &WebsocketManager{ funcMap: funcMap, Upgrader: websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { // TODO ??? return true }, }, logger: ...
[ "func", "NewWebsocketManager", "(", "funcMap", "map", "[", "string", "]", "*", "RPCFunc", ",", "logger", "*", "logging", ".", "Logger", ",", "wsConnOptions", "...", "func", "(", "*", "wsConnection", ")", ")", "*", "WebsocketManager", "{", "return", "&", "W...
// NewWebsocketManager returns a new WebsocketManager that routes according to // the given funcMap and connects to the server with the given connection // options.
[ "NewWebsocketManager", "returns", "a", "new", "WebsocketManager", "that", "routes", "according", "to", "the", "given", "funcMap", "and", "connects", "to", "the", "server", "with", "the", "given", "connection", "options", "." ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/lib/server/handlers.go#L686-L699
train
hyperledger/burrow
consensus/tendermint/sign_info.go
checkHRS
func (lsi *LastSignedInfo) checkHRS(height int64, round int, step int8) (bool, error) { if lsi.Height > height { return false, errors.New("Height regression") } if lsi.Height == height { if lsi.Round > round { return false, errors.New("Round regression") } if lsi.Round == round { if lsi.Step > step {...
go
func (lsi *LastSignedInfo) checkHRS(height int64, round int, step int8) (bool, error) { if lsi.Height > height { return false, errors.New("Height regression") } if lsi.Height == height { if lsi.Round > round { return false, errors.New("Round regression") } if lsi.Round == round { if lsi.Step > step {...
[ "func", "(", "lsi", "*", "LastSignedInfo", ")", "checkHRS", "(", "height", "int64", ",", "round", "int", ",", "step", "int8", ")", "(", "bool", ",", "error", ")", "{", "if", "lsi", ".", "Height", ">", "height", "{", "return", "false", ",", "errors", ...
// returns error if HRS regression or no SignBytes. returns true if HRS is unchanged
[ "returns", "error", "if", "HRS", "regression", "or", "no", "SignBytes", ".", "returns", "true", "if", "HRS", "is", "unchanged" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/consensus/tendermint/sign_info.go#L77-L102
train
hyperledger/burrow
consensus/tendermint/sign_info.go
String
func (lsi *LastSignedInfo) String() string { return fmt.Sprintf("PrivValidator{LH:%v, LR:%v, LS:%v}", lsi.Height, lsi.Round, lsi.Step) }
go
func (lsi *LastSignedInfo) String() string { return fmt.Sprintf("PrivValidator{LH:%v, LR:%v, LS:%v}", lsi.Height, lsi.Round, lsi.Step) }
[ "func", "(", "lsi", "*", "LastSignedInfo", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "lsi", ".", "Height", ",", "lsi", ".", "Round", ",", "lsi", ".", "Step", ")", "\n", "}" ]
// String returns a string representation of the LastSignedInfo.
[ "String", "returns", "a", "string", "representation", "of", "the", "LastSignedInfo", "." ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/consensus/tendermint/sign_info.go#L188-L190
train
hyperledger/burrow
util/snatives/templates/solidity_templates.go
InstanceName
func (contract *solidityContract) InstanceName() string { // Hopefully the contract name is UpperCamelCase. If it's not, oh well, this // is meant to be illustrative rather than cast iron compilable instanceName := strings.ToLower(contract.Name[:1]) + contract.Name[1:] if instanceName == contract.Name { return "c...
go
func (contract *solidityContract) InstanceName() string { // Hopefully the contract name is UpperCamelCase. If it's not, oh well, this // is meant to be illustrative rather than cast iron compilable instanceName := strings.ToLower(contract.Name[:1]) + contract.Name[1:] if instanceName == contract.Name { return "c...
[ "func", "(", "contract", "*", "solidityContract", ")", "InstanceName", "(", ")", "string", "{", "// Hopefully the contract name is UpperCamelCase. If it's not, oh well, this", "// is meant to be illustrative rather than cast iron compilable", "instanceName", ":=", "strings", ".", "...
// Get a version of the contract name to be used for an instance of the contract
[ "Get", "a", "version", "of", "the", "contract", "name", "to", "be", "used", "for", "an", "instance", "of", "the", "contract" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/util/snatives/templates/solidity_templates.go#L94-L102
train
hyperledger/burrow
util/snatives/templates/solidity_templates.go
Solidity
func (contract *solidityContract) Solidity() (string, error) { buf := new(bytes.Buffer) err := contractTemplate.Execute(buf, contract) if err != nil { return "", err } return buf.String(), nil }
go
func (contract *solidityContract) Solidity() (string, error) { buf := new(bytes.Buffer) err := contractTemplate.Execute(buf, contract) if err != nil { return "", err } return buf.String(), nil }
[ "func", "(", "contract", "*", "solidityContract", ")", "Solidity", "(", ")", "(", "string", ",", "error", ")", "{", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "err", ":=", "contractTemplate", ".", "Execute", "(", "buf", ",", "contract"...
// Generate Solidity code for this SNative contract
[ "Generate", "Solidity", "code", "for", "this", "SNative", "contract" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/util/snatives/templates/solidity_templates.go#L110-L117
train
hyperledger/burrow
vent/sqldb/adapters/db_adapter.go
clean
func clean(parameter string) string { replacer := strings.NewReplacer("\n", " ", "\t", "") return replacer.Replace(parameter) }
go
func clean(parameter string) string { replacer := strings.NewReplacer("\n", " ", "\t", "") return replacer.Replace(parameter) }
[ "func", "clean", "(", "parameter", "string", ")", "string", "{", "replacer", ":=", "strings", ".", "NewReplacer", "(", "\"", "\\n", "\"", ",", "\"", "\"", ",", "\"", "\\t", "\"", ",", "\"", "\"", ")", "\n", "return", "replacer", ".", "Replace", "(", ...
// clean queries from tabs, spaces and returns
[ "clean", "queries", "from", "tabs", "spaces", "and", "returns" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/db_adapter.go#L59-L62
train
hyperledger/burrow
logging/loggers/channel_logger.go
WaitReadLogLine
func (cl *ChannelLogger) WaitReadLogLine() []interface{} { logLine, ok := <-cl.ch.Out() return readLogLine(logLine, ok) }
go
func (cl *ChannelLogger) WaitReadLogLine() []interface{} { logLine, ok := <-cl.ch.Out() return readLogLine(logLine, ok) }
[ "func", "(", "cl", "*", "ChannelLogger", ")", "WaitReadLogLine", "(", ")", "[", "]", "interface", "{", "}", "{", "logLine", ",", "ok", ":=", "<-", "cl", ".", "ch", ".", "Out", "(", ")", "\n", "return", "readLogLine", "(", "logLine", ",", "ok", ")",...
// Read a log line by waiting until one is available and returning it
[ "Read", "a", "log", "line", "by", "waiting", "until", "one", "is", "available", "and", "returning", "it" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/channel_logger.go#L68-L71
train
hyperledger/burrow
logging/loggers/channel_logger.go
ReadLogLine
func (cl *ChannelLogger) ReadLogLine() []interface{} { select { case logLine, ok := <-cl.ch.Out(): return readLogLine(logLine, ok) default: return nil } }
go
func (cl *ChannelLogger) ReadLogLine() []interface{} { select { case logLine, ok := <-cl.ch.Out(): return readLogLine(logLine, ok) default: return nil } }
[ "func", "(", "cl", "*", "ChannelLogger", ")", "ReadLogLine", "(", ")", "[", "]", "interface", "{", "}", "{", "select", "{", "case", "logLine", ",", "ok", ":=", "<-", "cl", ".", "ch", ".", "Out", "(", ")", ":", "return", "readLogLine", "(", "logLine...
// Tries to read a log line from the channel buffer or returns nil if none is // immediately available
[ "Tries", "to", "read", "a", "log", "line", "from", "the", "channel", "buffer", "or", "returns", "nil", "if", "none", "is", "immediately", "available" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/channel_logger.go#L75-L82
train
hyperledger/burrow
logging/loggers/channel_logger.go
DrainForever
func (cl *ChannelLogger) DrainForever(logger log.Logger, errCh channels.Channel) { // logLine could be nil if channel was closed while waiting for next line for logLine := cl.WaitReadLogLine(); logLine != nil; logLine = cl.WaitReadLogLine() { err := logger.Log(logLine...) if err != nil && errCh != nil { errCh....
go
func (cl *ChannelLogger) DrainForever(logger log.Logger, errCh channels.Channel) { // logLine could be nil if channel was closed while waiting for next line for logLine := cl.WaitReadLogLine(); logLine != nil; logLine = cl.WaitReadLogLine() { err := logger.Log(logLine...) if err != nil && errCh != nil { errCh....
[ "func", "(", "cl", "*", "ChannelLogger", ")", "DrainForever", "(", "logger", "log", ".", "Logger", ",", "errCh", "channels", ".", "Channel", ")", "{", "// logLine could be nil if channel was closed while waiting for next line", "for", "logLine", ":=", "cl", ".", "Wa...
// Enters an infinite loop that will drain any log lines from the passed logger. // You may pass in a channel // // Exits if the channel is closed.
[ "Enters", "an", "infinite", "loop", "that", "will", "drain", "any", "log", "lines", "from", "the", "passed", "logger", ".", "You", "may", "pass", "in", "a", "channel", "Exits", "if", "the", "channel", "is", "closed", "." ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/channel_logger.go#L99-L107
train
hyperledger/burrow
logging/loggers/channel_logger.go
Flush
func (cl *ChannelLogger) Flush(logger log.Logger) error { // Grab the buffer at the here rather than within loop condition so that we // do not drain the buffer forever cl.Lock() defer cl.Unlock() bufferLength := cl.BufferLength() var errs []error for i := 0; i < bufferLength; i++ { logLine := cl.WaitReadLogLi...
go
func (cl *ChannelLogger) Flush(logger log.Logger) error { // Grab the buffer at the here rather than within loop condition so that we // do not drain the buffer forever cl.Lock() defer cl.Unlock() bufferLength := cl.BufferLength() var errs []error for i := 0; i < bufferLength; i++ { logLine := cl.WaitReadLogLi...
[ "func", "(", "cl", "*", "ChannelLogger", ")", "Flush", "(", "logger", "log", ".", "Logger", ")", "error", "{", "// Grab the buffer at the here rather than within loop condition so that we", "// do not drain the buffer forever", "cl", ".", "Lock", "(", ")", "\n", "defer"...
// Drains everything that is available at the time of calling
[ "Drains", "everything", "that", "is", "available", "at", "the", "time", "of", "calling" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/channel_logger.go#L110-L127
train
hyperledger/burrow
logging/loggers/channel_logger.go
FlushLogLines
func (cl *ChannelLogger) FlushLogLines() [][]interface{} { logLines := make([][]interface{}, 0, cl.ch.Len()) cl.Flush(log.LoggerFunc(func(keyvals ...interface{}) error { logLines = append(logLines, keyvals) return nil })) return logLines }
go
func (cl *ChannelLogger) FlushLogLines() [][]interface{} { logLines := make([][]interface{}, 0, cl.ch.Len()) cl.Flush(log.LoggerFunc(func(keyvals ...interface{}) error { logLines = append(logLines, keyvals) return nil })) return logLines }
[ "func", "(", "cl", "*", "ChannelLogger", ")", "FlushLogLines", "(", ")", "[", "]", "[", "]", "interface", "{", "}", "{", "logLines", ":=", "make", "(", "[", "]", "[", "]", "interface", "{", "}", ",", "0", ",", "cl", ".", "ch", ".", "Len", "(", ...
// Drains the next contiguous segment of loglines up to the buffer cap waiting // for at least one line
[ "Drains", "the", "next", "contiguous", "segment", "of", "loglines", "up", "to", "the", "buffer", "cap", "waiting", "for", "at", "least", "one", "line" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/channel_logger.go#L131-L138
train
hyperledger/burrow
logging/loggers/channel_logger.go
Reset
func (cl *ChannelLogger) Reset() { cl.RWMutex.Lock() defer cl.RWMutex.Unlock() cl.ch.Close() cl.ch = channels.NewRingChannel(cl.ch.Cap()) }
go
func (cl *ChannelLogger) Reset() { cl.RWMutex.Lock() defer cl.RWMutex.Unlock() cl.ch.Close() cl.ch = channels.NewRingChannel(cl.ch.Cap()) }
[ "func", "(", "cl", "*", "ChannelLogger", ")", "Reset", "(", ")", "{", "cl", ".", "RWMutex", ".", "Lock", "(", ")", "\n", "defer", "cl", ".", "RWMutex", ".", "Unlock", "(", ")", "\n", "cl", ".", "ch", ".", "Close", "(", ")", "\n", "cl", ".", "...
// Close the existing channel halting goroutines that are draining the channel // and create a new channel to buffer into. Should not cause any log lines // arriving concurrently to be lost, but any that have not been drained from // old channel may be.
[ "Close", "the", "existing", "channel", "halting", "goroutines", "that", "are", "draining", "the", "channel", "and", "create", "a", "new", "channel", "to", "buffer", "into", ".", "Should", "not", "cause", "any", "log", "lines", "arriving", "concurrently", "to",...
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/channel_logger.go#L144-L149
train
hyperledger/burrow
logging/loggers/channel_logger.go
NonBlockingLogger
func NonBlockingLogger(outputLogger log.Logger) (*ChannelLogger, channels.Channel) { cl := NewChannelLogger(DefaultLoggingRingBufferCap) errCh := channels.NewRingChannel(cl.BufferCap()) go cl.DrainForever(outputLogger, errCh) return cl, errCh }
go
func NonBlockingLogger(outputLogger log.Logger) (*ChannelLogger, channels.Channel) { cl := NewChannelLogger(DefaultLoggingRingBufferCap) errCh := channels.NewRingChannel(cl.BufferCap()) go cl.DrainForever(outputLogger, errCh) return cl, errCh }
[ "func", "NonBlockingLogger", "(", "outputLogger", "log", ".", "Logger", ")", "(", "*", "ChannelLogger", ",", "channels", ".", "Channel", ")", "{", "cl", ":=", "NewChannelLogger", "(", "DefaultLoggingRingBufferCap", ")", "\n", "errCh", ":=", "channels", ".", "N...
// Returns a Logger that wraps the outputLogger passed and does not block on // calls to Log and a channel of any errors from the underlying logger
[ "Returns", "a", "Logger", "that", "wraps", "the", "outputLogger", "passed", "and", "does", "not", "block", "on", "calls", "to", "Log", "and", "a", "channel", "of", "any", "errors", "from", "the", "underlying", "logger" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/channel_logger.go#L153-L158
train
hyperledger/burrow
execution/state/state.go
NewState
func NewState(db dbm.DB) *State { forest, err := storage.NewMutableForest(storage.NewPrefixDB(db, forestPrefix), defaultCacheCapacity) if err != nil { // This should only happen if we have negative cache capacity, which for us is a positive compile-time constant panic(fmt.Errorf("could not create new state becaus...
go
func NewState(db dbm.DB) *State { forest, err := storage.NewMutableForest(storage.NewPrefixDB(db, forestPrefix), defaultCacheCapacity) if err != nil { // This should only happen if we have negative cache capacity, which for us is a positive compile-time constant panic(fmt.Errorf("could not create new state becaus...
[ "func", "NewState", "(", "db", "dbm", ".", "DB", ")", "*", "State", "{", "forest", ",", "err", ":=", "storage", ".", "NewMutableForest", "(", "storage", ".", "NewPrefixDB", "(", "db", ",", "forestPrefix", ")", ",", "defaultCacheCapacity", ")", "\n", "if"...
// Create a new State object
[ "Create", "a", "new", "State", "object" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/state/state.go#L115-L130
train
hyperledger/burrow
execution/state/state.go
MakeGenesisState
func MakeGenesisState(db dbm.DB, genesisDoc *genesis.GenesisDoc) (*State, error) { s := NewState(db) const errHeader = "MakeGenesisState():" // Make accounts state tree for _, genAcc := range genesisDoc.Accounts { perm := genAcc.Permissions acc := &acm.Account{ Address: genAcc.Address, Balance: g...
go
func MakeGenesisState(db dbm.DB, genesisDoc *genesis.GenesisDoc) (*State, error) { s := NewState(db) const errHeader = "MakeGenesisState():" // Make accounts state tree for _, genAcc := range genesisDoc.Accounts { perm := genAcc.Permissions acc := &acm.Account{ Address: genAcc.Address, Balance: g...
[ "func", "MakeGenesisState", "(", "db", "dbm", ".", "DB", ",", "genesisDoc", "*", "genesis", ".", "GenesisDoc", ")", "(", "*", "State", ",", "error", ")", "{", "s", ":=", "NewState", "(", "db", ")", "\n\n", "const", "errHeader", "=", "\"", "\"", "\n",...
// Make genesis state from GenesisDoc and save to DB
[ "Make", "genesis", "state", "from", "GenesisDoc", "and", "save", "to", "DB" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/state/state.go#L133-L174
train
hyperledger/burrow
execution/state/state.go
Update
func (s *State) Update(updater func(up Updatable) error) ([]byte, int64, error) { s.Lock() defer s.Unlock() err := updater(&s.writeState) if err != nil { return nil, 0, err } return s.commit() }
go
func (s *State) Update(updater func(up Updatable) error) ([]byte, int64, error) { s.Lock() defer s.Unlock() err := updater(&s.writeState) if err != nil { return nil, 0, err } return s.commit() }
[ "func", "(", "s", "*", "State", ")", "Update", "(", "updater", "func", "(", "up", "Updatable", ")", "error", ")", "(", "[", "]", "byte", ",", "int64", ",", "error", ")", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ...
// Perform updates to state whilst holding the write lock, allows a commit to hold the write lock across multiple // operations while preventing interlaced reads and writes
[ "Perform", "updates", "to", "state", "whilst", "holding", "the", "write", "lock", "allows", "a", "commit", "to", "hold", "the", "write", "lock", "across", "multiple", "operations", "while", "preventing", "interlaced", "reads", "and", "writes" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/state/state.go#L244-L252
train
hyperledger/burrow
execution/state/state.go
Copy
func (s *State) Copy(db dbm.DB) (*State, error) { stateCopy := NewState(db) err := s.writeState.forest.IterateRWTree(nil, nil, true, func(prefix []byte, tree *storage.RWTree) error { treeCopy, err := stateCopy.writeState.forest.Writer(prefix) if err != nil { return err } return tree.IterateWriteTree...
go
func (s *State) Copy(db dbm.DB) (*State, error) { stateCopy := NewState(db) err := s.writeState.forest.IterateRWTree(nil, nil, true, func(prefix []byte, tree *storage.RWTree) error { treeCopy, err := stateCopy.writeState.forest.Writer(prefix) if err != nil { return err } return tree.IterateWriteTree...
[ "func", "(", "s", "*", "State", ")", "Copy", "(", "db", "dbm", ".", "DB", ")", "(", "*", "State", ",", "error", ")", "{", "stateCopy", ":=", "NewState", "(", "db", ")", "\n", "err", ":=", "s", ".", "writeState", ".", "forest", ".", "IterateRWTree...
// Creates a copy of the database to the supplied db
[ "Creates", "a", "copy", "of", "the", "database", "to", "the", "supplied", "db" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/state/state.go#L272-L293
train
hyperledger/burrow
vent/sqldb/sqldb.go
NewSQLDB
func NewSQLDB(connection types.SQLConnection) (*SQLDB, error) { db := &SQLDB{ Schema: connection.DBSchema, Log: connection.Log, } var url string switch connection.DBAdapter { case types.PostgresDB: db.DBAdapter = adapters.NewPostgresAdapter(safe(connection.DBSchema), connection.Log) url = connection.D...
go
func NewSQLDB(connection types.SQLConnection) (*SQLDB, error) { db := &SQLDB{ Schema: connection.DBSchema, Log: connection.Log, } var url string switch connection.DBAdapter { case types.PostgresDB: db.DBAdapter = adapters.NewPostgresAdapter(safe(connection.DBSchema), connection.Log) url = connection.D...
[ "func", "NewSQLDB", "(", "connection", "types", ".", "SQLConnection", ")", "(", "*", "SQLDB", ",", "error", ")", "{", "db", ":=", "&", "SQLDB", "{", "Schema", ":", "connection", ".", "DBSchema", ",", "Log", ":", "connection", ".", "Log", ",", "}", "\...
// NewSQLDB delegates work to a specific database adapter implementation, // opens database connection and create log tables
[ "NewSQLDB", "delegates", "work", "to", "a", "specific", "database", "adapter", "implementation", "opens", "database", "connection", "and", "create", "log", "tables" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/sqldb.go#L26-L94
train
hyperledger/burrow
vent/sqldb/sqldb.go
Close
func (db *SQLDB) Close() { if err := db.DB.Close(); err != nil { db.Log.Error("msg", "Error closing database", "err", err) } }
go
func (db *SQLDB) Close() { if err := db.DB.Close(); err != nil { db.Log.Error("msg", "Error closing database", "err", err) } }
[ "func", "(", "db", "*", "SQLDB", ")", "Close", "(", ")", "{", "if", "err", ":=", "db", ".", "DB", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "db", ".", "Log", ".", "Error", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ","...
// Close database connection
[ "Close", "database", "connection" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/sqldb.go#L222-L226
train
hyperledger/burrow
vent/sqldb/sqldb.go
GetLastBlockHeight
func (db *SQLDB) GetLastBlockHeight() (uint64, error) { query := db.DBAdapter.LastBlockIDQuery() id := "" db.Log.Info("msg", "MAX ID", "query", query) if err := db.DB.QueryRow(query).Scan(&id); err != nil { db.Log.Info("msg", "Error selecting last block id", "err", err) return 0, err } height, err := strcon...
go
func (db *SQLDB) GetLastBlockHeight() (uint64, error) { query := db.DBAdapter.LastBlockIDQuery() id := "" db.Log.Info("msg", "MAX ID", "query", query) if err := db.DB.QueryRow(query).Scan(&id); err != nil { db.Log.Info("msg", "Error selecting last block id", "err", err) return 0, err } height, err := strcon...
[ "func", "(", "db", "*", "SQLDB", ")", "GetLastBlockHeight", "(", ")", "(", "uint64", ",", "error", ")", "{", "query", ":=", "db", ".", "DBAdapter", ".", "LastBlockIDQuery", "(", ")", "\n", "id", ":=", "\"", "\"", "\n\n", "db", ".", "Log", ".", "Inf...
// GetLastBlockID returns last inserted blockId from log table
[ "GetLastBlockID", "returns", "last", "inserted", "blockId", "from", "log", "table" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/sqldb.go#L239-L254
train
hyperledger/burrow
vent/sqldb/sqldb.go
SynchronizeDB
func (db *SQLDB) SynchronizeDB(eventTables types.EventTables) error { db.Log.Info("msg", "Synchronizing DB") for _, table := range eventTables { found, err := db.findTable(table.Name) if err != nil { return err } if found { err = db.alterTable(table) } else { err = db.createTable(table, false) ...
go
func (db *SQLDB) SynchronizeDB(eventTables types.EventTables) error { db.Log.Info("msg", "Synchronizing DB") for _, table := range eventTables { found, err := db.findTable(table.Name) if err != nil { return err } if found { err = db.alterTable(table) } else { err = db.createTable(table, false) ...
[ "func", "(", "db", "*", "SQLDB", ")", "SynchronizeDB", "(", "eventTables", "types", ".", "EventTables", ")", "error", "{", "db", ".", "Log", ".", "Info", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "for", "_", ",", "table", ":=", "range", "event...
// SynchronizeDB synchronize db tables structures from given tables specifications
[ "SynchronizeDB", "synchronize", "db", "tables", "structures", "from", "given", "tables", "specifications" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/sqldb.go#L257-L277
train
hyperledger/burrow
vent/sqldb/sqldb.go
GetBlock
func (db *SQLDB) GetBlock(height uint64) (types.EventData, error) { var data types.EventData data.BlockHeight = height data.Tables = make(map[string]types.EventDataTable) // get all table structures involved in the block tables, err := db.getBlockTables(height) if err != nil { return data, err } query := ""...
go
func (db *SQLDB) GetBlock(height uint64) (types.EventData, error) { var data types.EventData data.BlockHeight = height data.Tables = make(map[string]types.EventDataTable) // get all table structures involved in the block tables, err := db.getBlockTables(height) if err != nil { return data, err } query := ""...
[ "func", "(", "db", "*", "SQLDB", ")", "GetBlock", "(", "height", "uint64", ")", "(", "types", ".", "EventData", ",", "error", ")", "{", "var", "data", "types", ".", "EventData", "\n", "data", ".", "BlockHeight", "=", "height", "\n", "data", ".", "Tab...
// GetBlock returns all tables structures and row data for given block
[ "GetBlock", "returns", "all", "tables", "structures", "and", "row", "data", "for", "given", "block" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/sqldb.go#L428-L502
train
hyperledger/burrow
vent/sqldb/sqldb.go
RestoreDB
func (db *SQLDB) RestoreDB(time time.Time, prefix string) error { const yymmddhhmmss = "2006-01-02 15:04:05" var pointers []interface{} if prefix == "" { return fmt.Errorf("error prefix mus not be empty") } // Get Restore DB query query := db.DBAdapter.RestoreDBQuery() strTime := time.Format(yymmddhhmmss) ...
go
func (db *SQLDB) RestoreDB(time time.Time, prefix string) error { const yymmddhhmmss = "2006-01-02 15:04:05" var pointers []interface{} if prefix == "" { return fmt.Errorf("error prefix mus not be empty") } // Get Restore DB query query := db.DBAdapter.RestoreDBQuery() strTime := time.Format(yymmddhhmmss) ...
[ "func", "(", "db", "*", "SQLDB", ")", "RestoreDB", "(", "time", "time", ".", "Time", ",", "prefix", "string", ")", "error", "{", "const", "yymmddhhmmss", "=", "\"", "\"", "\n\n", "var", "pointers", "[", "]", "interface", "{", "}", "\n\n", "if", "pref...
// RestoreDB restores the DB to a given moment in time
[ "RestoreDB", "restores", "the", "DB", "to", "a", "given", "moment", "in", "time" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/sqldb.go#L505-L580
train
hyperledger/burrow
storage/immutable_forest.go
Reader
func (imf *ImmutableForest) Reader(prefix []byte) (KVCallbackIterableReader, error) { return imf.tree(prefix) }
go
func (imf *ImmutableForest) Reader(prefix []byte) (KVCallbackIterableReader, error) { return imf.tree(prefix) }
[ "func", "(", "imf", "*", "ImmutableForest", ")", "Reader", "(", "prefix", "[", "]", "byte", ")", "(", "KVCallbackIterableReader", ",", "error", ")", "{", "return", "imf", ".", "tree", "(", "prefix", ")", "\n", "}" ]
// Get the tree at prefix for making reads
[ "Get", "the", "tree", "at", "prefix", "for", "making", "reads" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/immutable_forest.go#L69-L71
train
hyperledger/burrow
storage/immutable_forest.go
tree
func (imf *ImmutableForest) tree(prefix []byte) (*RWTree, error) { // Try cache if value, ok := imf.treeCache.Get(string(prefix)); ok { return value.(*RWTree), nil } // Not in caches but non-negative version - we should be able to load into memory return imf.loadOrCreateTree(prefix) }
go
func (imf *ImmutableForest) tree(prefix []byte) (*RWTree, error) { // Try cache if value, ok := imf.treeCache.Get(string(prefix)); ok { return value.(*RWTree), nil } // Not in caches but non-negative version - we should be able to load into memory return imf.loadOrCreateTree(prefix) }
[ "func", "(", "imf", "*", "ImmutableForest", ")", "tree", "(", "prefix", "[", "]", "byte", ")", "(", "*", "RWTree", ",", "error", ")", "{", "// Try cache", "if", "value", ",", "ok", ":=", "imf", ".", "treeCache", ".", "Get", "(", "string", "(", "pre...
// Lazy load tree
[ "Lazy", "load", "tree" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/immutable_forest.go#L74-L81
train
hyperledger/burrow
storage/immutable_forest.go
newTree
func (imf *ImmutableForest) newTree(prefix []byte) *RWTree { p := string(prefix) tree := NewRWTree(NewPrefixDB(imf.treeDB, p), imf.cacheSize) imf.treeCache.Add(p, tree) return tree }
go
func (imf *ImmutableForest) newTree(prefix []byte) *RWTree { p := string(prefix) tree := NewRWTree(NewPrefixDB(imf.treeDB, p), imf.cacheSize) imf.treeCache.Add(p, tree) return tree }
[ "func", "(", "imf", "*", "ImmutableForest", ")", "newTree", "(", "prefix", "[", "]", "byte", ")", "*", "RWTree", "{", "p", ":=", "string", "(", "prefix", ")", "\n", "tree", ":=", "NewRWTree", "(", "NewPrefixDB", "(", "imf", ".", "treeDB", ",", "p", ...
// Create a new in-memory IAVL tree
[ "Create", "a", "new", "in", "-", "memory", "IAVL", "tree" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/immutable_forest.go#L114-L119
train
hyperledger/burrow
deploy/def/rule/rules.go
stripBraces
func stripBraces(str string) string { bs := []byte(str) const lb = byte('{') const rb = byte('}') start := 0 for i := 0; i < len(bs); i++ { switch bs[i] { case lb: start = i + 1 case rb: return `\$` + str[start:i] } } return str[start:] }
go
func stripBraces(str string) string { bs := []byte(str) const lb = byte('{') const rb = byte('}') start := 0 for i := 0; i < len(bs); i++ { switch bs[i] { case lb: start = i + 1 case rb: return `\$` + str[start:i] } } return str[start:] }
[ "func", "stripBraces", "(", "str", "string", ")", "string", "{", "bs", ":=", "[", "]", "byte", "(", "str", ")", "\n", "const", "lb", "=", "byte", "(", "'{'", ")", "\n", "const", "rb", "=", "byte", "(", "'}'", ")", "\n", "start", ":=", "0", "\n"...
// Strips braces and return simple variable confined between braces
[ "Strips", "braces", "and", "return", "simple", "variable", "confined", "between", "braces" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/def/rule/rules.go#L76-L90
train
hyperledger/burrow
deploy/def/rule/rules.go
IsOmitted
func IsOmitted(value interface{}) bool { value, isNil := validation.Indirect(value) if isNil || validation.IsEmpty(value) { return true } // Accept and empty slice or map length, err := validation.LengthOfValue(value) if err == nil && length == 0 { return true } return false }
go
func IsOmitted(value interface{}) bool { value, isNil := validation.Indirect(value) if isNil || validation.IsEmpty(value) { return true } // Accept and empty slice or map length, err := validation.LengthOfValue(value) if err == nil && length == 0 { return true } return false }
[ "func", "IsOmitted", "(", "value", "interface", "{", "}", ")", "bool", "{", "value", ",", "isNil", ":=", "validation", ".", "Indirect", "(", "value", ")", "\n", "if", "isNil", "||", "validation", ".", "IsEmpty", "(", "value", ")", "{", "return", "true"...
// Returns true IFF value is zero value or has length 0
[ "Returns", "true", "IFF", "value", "is", "zero", "value", "or", "has", "length", "0" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/def/rule/rules.go#L171-L182
train
hyperledger/burrow
util/fs.go
EnsureDir
func EnsureDir(dir string, mode os.FileMode) error { if fileOptions, err := os.Stat(dir); os.IsNotExist(err) { if errMake := os.MkdirAll(dir, mode); errMake != nil { return fmt.Errorf("Could not create directory %s. %v", dir, err) } } else if err != nil { return fmt.Errorf("Error asserting directory %s: %v",...
go
func EnsureDir(dir string, mode os.FileMode) error { if fileOptions, err := os.Stat(dir); os.IsNotExist(err) { if errMake := os.MkdirAll(dir, mode); errMake != nil { return fmt.Errorf("Could not create directory %s. %v", dir, err) } } else if err != nil { return fmt.Errorf("Error asserting directory %s: %v",...
[ "func", "EnsureDir", "(", "dir", "string", ",", "mode", "os", ".", "FileMode", ")", "error", "{", "if", "fileOptions", ",", "err", ":=", "os", ".", "Stat", "(", "dir", ")", ";", "os", ".", "IsNotExist", "(", "err", ")", "{", "if", "errMake", ":=", ...
// Ensure the directory exists or create it if needed.
[ "Ensure", "the", "directory", "exists", "or", "create", "it", "if", "needed", "." ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/util/fs.go#L24-L35
train
hyperledger/burrow
util/fs.go
IsDir
func IsDir(directory string) bool { fileInfo, err := os.Stat(directory) if err != nil { return false } return fileInfo.IsDir() }
go
func IsDir(directory string) bool { fileInfo, err := os.Stat(directory) if err != nil { return false } return fileInfo.IsDir() }
[ "func", "IsDir", "(", "directory", "string", ")", "bool", "{", "fileInfo", ",", "err", ":=", "os", ".", "Stat", "(", "directory", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", "\n", "}", "\n", "return", "fileInfo", ".", "IsDir", "(", ...
// Check whether the provided directory exists
[ "Check", "whether", "the", "provided", "directory", "exists" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/util/fs.go#L38-L44
train
hyperledger/burrow
keys/mock/key.go
MonaxKeysJSON
func (key *Key) MonaxKeysJSON() string { jsonKey := plainKeyJSON{ Address: key.Address.String(), Type: "ed25519", PrivateKey: PrivateKeyplainKeyJSON{Plain: key.PrivateKey}, } bs, err := json.Marshal(jsonKey) if err != nil { return errors.Wrap(err, "could not create monax key json").Error() } retu...
go
func (key *Key) MonaxKeysJSON() string { jsonKey := plainKeyJSON{ Address: key.Address.String(), Type: "ed25519", PrivateKey: PrivateKeyplainKeyJSON{Plain: key.PrivateKey}, } bs, err := json.Marshal(jsonKey) if err != nil { return errors.Wrap(err, "could not create monax key json").Error() } retu...
[ "func", "(", "key", "*", "Key", ")", "MonaxKeysJSON", "(", ")", "string", "{", "jsonKey", ":=", "plainKeyJSON", "{", "Address", ":", "key", ".", "Address", ".", "String", "(", ")", ",", "Type", ":", "\"", "\"", ",", "PrivateKey", ":", "PrivateKeyplainK...
// Returns JSON string compatible with that stored by monax-keys
[ "Returns", "JSON", "string", "compatible", "with", "that", "stored", "by", "monax", "-", "keys" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/keys/mock/key.go#L87-L98
train
hyperledger/burrow
execution/evm/snative.go
NewSNativeContract
func NewSNativeContract(comment, name string, functions ...*SNativeFunctionDescription) *SNativeContractDescription { functionsByID := make(map[abi.FunctionID]*SNativeFunctionDescription, len(functions)) for _, f := range functions { f.Abi = *abi.SpecFromStructReflect(f.Name, f.Arguments, f.Returns) fid := f.A...
go
func NewSNativeContract(comment, name string, functions ...*SNativeFunctionDescription) *SNativeContractDescription { functionsByID := make(map[abi.FunctionID]*SNativeFunctionDescription, len(functions)) for _, f := range functions { f.Abi = *abi.SpecFromStructReflect(f.Name, f.Arguments, f.Returns) fid := f.A...
[ "func", "NewSNativeContract", "(", "comment", ",", "name", "string", ",", "functions", "...", "*", "SNativeFunctionDescription", ")", "*", "SNativeContractDescription", "{", "functionsByID", ":=", "make", "(", "map", "[", "abi", ".", "FunctionID", "]", "*", "SNa...
// Create a new SNative contract description object by passing a comment, name // and a list of member functions descriptions
[ "Create", "a", "new", "SNative", "contract", "description", "object", "by", "passing", "a", "comment", "name", "and", "a", "list", "of", "member", "functions", "descriptions" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/snative.go#L190-L210
train
hyperledger/burrow
execution/evm/snative.go
Dispatch
func (contract *SNativeContractDescription) Dispatch(st Interface, caller crypto.Address, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { logger = logger.With(structure.ScopeKey, "Dispatch", "contract_name", contract.Name) if len(args) < abi.FunctionIDSize { return nil, errors.Erro...
go
func (contract *SNativeContractDescription) Dispatch(st Interface, caller crypto.Address, args []byte, gas *uint64, logger *logging.Logger) (output []byte, err error) { logger = logger.With(structure.ScopeKey, "Dispatch", "contract_name", contract.Name) if len(args) < abi.FunctionIDSize { return nil, errors.Erro...
[ "func", "(", "contract", "*", "SNativeContractDescription", ")", "Dispatch", "(", "st", "Interface", ",", "caller", "crypto", ".", "Address", ",", "args", "[", "]", "byte", ",", "gas", "*", "uint64", ",", "logger", "*", "logging", ".", "Logger", ")", "("...
// This function is designed to be called from the EVM once a SNative contract // has been selected. It is also placed in a registry by registerSNativeContracts // So it can be looked up by SNative address
[ "This", "function", "is", "designed", "to", "be", "called", "from", "the", "EVM", "once", "a", "SNative", "contract", "has", "been", "selected", ".", "It", "is", "also", "placed", "in", "a", "registry", "by", "registerSNativeContracts", "So", "it", "can", ...
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/snative.go#L215-L260
train
hyperledger/burrow
execution/evm/snative.go
Address
func (contract *SNativeContractDescription) Address() (address crypto.Address) { hash := sha3.Sha3([]byte(contract.Name)) copy(address[:], hash[len(hash)-crypto.AddressLength:]) return }
go
func (contract *SNativeContractDescription) Address() (address crypto.Address) { hash := sha3.Sha3([]byte(contract.Name)) copy(address[:], hash[len(hash)-crypto.AddressLength:]) return }
[ "func", "(", "contract", "*", "SNativeContractDescription", ")", "Address", "(", ")", "(", "address", "crypto", ".", "Address", ")", "{", "hash", ":=", "sha3", ".", "Sha3", "(", "[", "]", "byte", "(", "contract", ".", "Name", ")", ")", "\n", "copy", ...
// We define the address of an SNative contact as the last 20 bytes of the sha3 // hash of its name
[ "We", "define", "the", "address", "of", "an", "SNative", "contact", "as", "the", "last", "20", "bytes", "of", "the", "sha3", "hash", "of", "its", "name" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/snative.go#L264-L268
train
hyperledger/burrow
execution/evm/snative.go
FunctionByID
func (contract *SNativeContractDescription) FunctionByID(id abi.FunctionID) (*SNativeFunctionDescription, errors.CodedError) { f, ok := contract.functionsByID[id] if !ok { return nil, errors.ErrorCodef(errors.ErrorCodeNativeFunction, "unknown SNative function with ID %x", id) } return f, nil }
go
func (contract *SNativeContractDescription) FunctionByID(id abi.FunctionID) (*SNativeFunctionDescription, errors.CodedError) { f, ok := contract.functionsByID[id] if !ok { return nil, errors.ErrorCodef(errors.ErrorCodeNativeFunction, "unknown SNative function with ID %x", id) } return f, nil }
[ "func", "(", "contract", "*", "SNativeContractDescription", ")", "FunctionByID", "(", "id", "abi", ".", "FunctionID", ")", "(", "*", "SNativeFunctionDescription", ",", "errors", ".", "CodedError", ")", "{", "f", ",", "ok", ":=", "contract", ".", "functionsByID...
// Get function by calling identifier FunctionSelector
[ "Get", "function", "by", "calling", "identifier", "FunctionSelector" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/snative.go#L271-L278
train
hyperledger/burrow
execution/evm/snative.go
FunctionByName
func (contract *SNativeContractDescription) FunctionByName(name string) (*SNativeFunctionDescription, error) { for _, f := range contract.functions { if f.Name == name { return f, nil } } return nil, fmt.Errorf("unknown SNative function with name %s", name) }
go
func (contract *SNativeContractDescription) FunctionByName(name string) (*SNativeFunctionDescription, error) { for _, f := range contract.functions { if f.Name == name { return f, nil } } return nil, fmt.Errorf("unknown SNative function with name %s", name) }
[ "func", "(", "contract", "*", "SNativeContractDescription", ")", "FunctionByName", "(", "name", "string", ")", "(", "*", "SNativeFunctionDescription", ",", "error", ")", "{", "for", "_", ",", "f", ":=", "range", "contract", ".", "functions", "{", "if", "f", ...
// Get function by name
[ "Get", "function", "by", "name" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/snative.go#L281-L288
train
hyperledger/burrow
execution/evm/snative.go
Functions
func (contract *SNativeContractDescription) Functions() []*SNativeFunctionDescription { functions := make([]*SNativeFunctionDescription, len(contract.functions)) copy(functions, contract.functions) return functions }
go
func (contract *SNativeContractDescription) Functions() []*SNativeFunctionDescription { functions := make([]*SNativeFunctionDescription, len(contract.functions)) copy(functions, contract.functions) return functions }
[ "func", "(", "contract", "*", "SNativeContractDescription", ")", "Functions", "(", ")", "[", "]", "*", "SNativeFunctionDescription", "{", "functions", ":=", "make", "(", "[", "]", "*", "SNativeFunctionDescription", ",", "len", "(", "contract", ".", "functions", ...
// Get functions in order of declaration
[ "Get", "functions", "in", "order", "of", "declaration" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/snative.go#L291-L295
train
hyperledger/burrow
execution/evm/snative.go
Signature
func (function *SNativeFunctionDescription) Signature() string { argTypeNames := make([]string, len(function.Abi.Inputs)) for i, arg := range function.Abi.Inputs { argTypeNames[i] = arg.EVM.GetSignature() } return fmt.Sprintf("%s(%s)", function.Name, strings.Join(argTypeNames, ",")) }
go
func (function *SNativeFunctionDescription) Signature() string { argTypeNames := make([]string, len(function.Abi.Inputs)) for i, arg := range function.Abi.Inputs { argTypeNames[i] = arg.EVM.GetSignature() } return fmt.Sprintf("%s(%s)", function.Name, strings.Join(argTypeNames, ",")) }
[ "func", "(", "function", "*", "SNativeFunctionDescription", ")", "Signature", "(", ")", "string", "{", "argTypeNames", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "function", ".", "Abi", ".", "Inputs", ")", ")", "\n", "for", "i", ",", "arg"...
// // SNative functions // // Get function signature
[ "SNative", "functions", "Get", "function", "signature" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/snative.go#L302-L309
train
hyperledger/burrow
event/query/tags.go
AddTags
func (ct *CombinedTags) AddTags(concat bool, tagsList ...Tagged) { for _, t := range tagsList { for _, k := range t.Keys() { if len(ct.ks[k]) == 0 { ct.keys = append(ct.keys, k) // Store reference to key-holder amongst Taggeds ct.ks[k] = append(ct.ks[k], t) } else if concat { // Store additiona...
go
func (ct *CombinedTags) AddTags(concat bool, tagsList ...Tagged) { for _, t := range tagsList { for _, k := range t.Keys() { if len(ct.ks[k]) == 0 { ct.keys = append(ct.keys, k) // Store reference to key-holder amongst Taggeds ct.ks[k] = append(ct.ks[k], t) } else if concat { // Store additiona...
[ "func", "(", "ct", "*", "CombinedTags", ")", "AddTags", "(", "concat", "bool", ",", "tagsList", "...", "Tagged", ")", "{", "for", "_", ",", "t", ":=", "range", "tagsList", "{", "for", "_", ",", "k", ":=", "range", "t", ".", "Keys", "(", ")", "{",...
// Adds each of tagsList to CombinedTags - choosing whether values for the same key should // be concatenated or whether the first should value should stick
[ "Adds", "each", "of", "tagsList", "to", "CombinedTags", "-", "choosing", "whether", "values", "for", "the", "same", "key", "should", "be", "concatenated", "or", "whether", "the", "first", "should", "value", "should", "stick" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/query/tags.go#L80-L93
train
hyperledger/burrow
config/source/source.go
SetSkip
func (cs *configSource) SetSkip(skip bool) ConfigProvider { return &configSource{ skip: skip, from: cs.from, apply: cs.apply, } }
go
func (cs *configSource) SetSkip(skip bool) ConfigProvider { return &configSource{ skip: skip, from: cs.from, apply: cs.apply, } }
[ "func", "(", "cs", "*", "configSource", ")", "SetSkip", "(", "skip", "bool", ")", "ConfigProvider", "{", "return", "&", "configSource", "{", "skip", ":", "skip", ",", "from", ":", "cs", ".", "from", ",", "apply", ":", "cs", ".", "apply", ",", "}", ...
// Returns a copy of the configSource with skip set as passed in
[ "Returns", "a", "copy", "of", "the", "configSource", "with", "skip", "set", "as", "passed", "in" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/config/source/source.go#L73-L79
train
hyperledger/burrow
config/source/source.go
XDGBaseDir
func XDGBaseDir(configFileName string) *configSource { skip := false // Look for config in standard XDG specified locations configFile, err := xdgbasedir.GetConfigFileLocation(configFileName) if err == nil { _, err := os.Stat(configFile) // Skip if config file does not exist at default location skip = os.IsN...
go
func XDGBaseDir(configFileName string) *configSource { skip := false // Look for config in standard XDG specified locations configFile, err := xdgbasedir.GetConfigFileLocation(configFileName) if err == nil { _, err := os.Stat(configFile) // Skip if config file does not exist at default location skip = os.IsN...
[ "func", "XDGBaseDir", "(", "configFileName", "string", ")", "*", "configSource", "{", "skip", ":=", "false", "\n", "// Look for config in standard XDG specified locations", "configFile", ",", "err", ":=", "xdgbasedir", ".", "GetConfigFileLocation", "(", "configFileName", ...
// Try to find config by using XDG base dir spec
[ "Try", "to", "find", "config", "by", "using", "XDG", "base", "dir", "spec" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/config/source/source.go#L150-L169
train
hyperledger/burrow
config/source/source.go
Environment
func Environment(key string) *configSource { configString := os.Getenv(key) return &configSource{ skip: configString == "", from: fmt.Sprintf("'%s' environment variable", key), apply: func(baseConfig interface{}) error { return FromString(configString, baseConfig) }, } }
go
func Environment(key string) *configSource { configString := os.Getenv(key) return &configSource{ skip: configString == "", from: fmt.Sprintf("'%s' environment variable", key), apply: func(baseConfig interface{}) error { return FromString(configString, baseConfig) }, } }
[ "func", "Environment", "(", "key", "string", ")", "*", "configSource", "{", "configString", ":=", "os", ".", "Getenv", "(", "key", ")", "\n", "return", "&", "configSource", "{", "skip", ":", "configString", "==", "\"", "\"", ",", "from", ":", "fmt", "....
// Source from a single environment variable with config embedded in JSON
[ "Source", "from", "a", "single", "environment", "variable", "with", "config", "embedded", "in", "JSON" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/config/source/source.go#L172-L181
train
hyperledger/burrow
config/source/source.go
DeepCopy
func DeepCopy(conf interface{}) (interface{}, error) { // Create a zero value confCopy := reflect.New(reflect.TypeOf(conf).Elem()).Interface() // Perform a merge into that value to effect the copy err := mergo.Merge(confCopy, conf) if err != nil { return nil, err } return confCopy, nil }
go
func DeepCopy(conf interface{}) (interface{}, error) { // Create a zero value confCopy := reflect.New(reflect.TypeOf(conf).Elem()).Interface() // Perform a merge into that value to effect the copy err := mergo.Merge(confCopy, conf) if err != nil { return nil, err } return confCopy, nil }
[ "func", "DeepCopy", "(", "conf", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "// Create a zero value", "confCopy", ":=", "reflect", ".", "New", "(", "reflect", ".", "TypeOf", "(", "conf", ")", ".", "Elem", "(", ")", ...
// Passed a pointer to struct creates a deep copy of the struct
[ "Passed", "a", "pointer", "to", "struct", "creates", "a", "deep", "copy", "of", "the", "struct" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/config/source/source.go#L266-L275
train
hyperledger/burrow
vent/sqlsol/projection.go
NewProjectionFromBytes
func NewProjectionFromBytes(bs []byte) (*Projection, error) { eventSpec := types.EventSpec{} err := ValidateJSONEventSpec(bs) if err != nil { return nil, err } err = json.Unmarshal(bs, &eventSpec) if err != nil { return nil, errors.Wrap(err, "Error unmarshalling eventSpec") } return NewProjectionFromEven...
go
func NewProjectionFromBytes(bs []byte) (*Projection, error) { eventSpec := types.EventSpec{} err := ValidateJSONEventSpec(bs) if err != nil { return nil, err } err = json.Unmarshal(bs, &eventSpec) if err != nil { return nil, errors.Wrap(err, "Error unmarshalling eventSpec") } return NewProjectionFromEven...
[ "func", "NewProjectionFromBytes", "(", "bs", "[", "]", "byte", ")", "(", "*", "Projection", ",", "error", ")", "{", "eventSpec", ":=", "types", ".", "EventSpec", "{", "}", "\n\n", "err", ":=", "ValidateJSONEventSpec", "(", "bs", ")", "\n", "if", "err", ...
// NewProjectionFromBytes creates a Projection from a stream of bytes
[ "NewProjectionFromBytes", "creates", "a", "Projection", "from", "a", "stream", "of", "bytes" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/projection.go#L26-L40
train
hyperledger/burrow
vent/sqlsol/projection.go
NewProjectionFromFolder
func NewProjectionFromFolder(specFileOrDirs ...string) (*Projection, error) { eventSpec := types.EventSpec{} const errHeader = "NewProjectionFromFolder():" for _, dir := range specFileOrDirs { err := filepath.Walk(dir, func(path string, _ os.FileInfo, err error) error { if err != nil { return fmt.Errorf("...
go
func NewProjectionFromFolder(specFileOrDirs ...string) (*Projection, error) { eventSpec := types.EventSpec{} const errHeader = "NewProjectionFromFolder():" for _, dir := range specFileOrDirs { err := filepath.Walk(dir, func(path string, _ os.FileInfo, err error) error { if err != nil { return fmt.Errorf("...
[ "func", "NewProjectionFromFolder", "(", "specFileOrDirs", "...", "string", ")", "(", "*", "Projection", ",", "error", ")", "{", "eventSpec", ":=", "types", ".", "EventSpec", "{", "}", "\n\n", "const", "errHeader", "=", "\"", "\"", "\n\n", "for", "_", ",", ...
// NewProjectionFromFolder creates a Projection from a folder containing spec files
[ "NewProjectionFromFolder", "creates", "a", "Projection", "from", "a", "folder", "containing", "spec", "files" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/projection.go#L43-L81
train
hyperledger/burrow
vent/sqlsol/projection.go
NewProjectionFromEventSpec
func NewProjectionFromEventSpec(eventSpec types.EventSpec) (*Projection, error) { // builds abi information from specification tables := make(types.EventTables) // obtain global field mappings to add to table definitions globalFieldMappings := getGlobalFieldMappings() for _, eventClass := range eventSpec { // ...
go
func NewProjectionFromEventSpec(eventSpec types.EventSpec) (*Projection, error) { // builds abi information from specification tables := make(types.EventTables) // obtain global field mappings to add to table definitions globalFieldMappings := getGlobalFieldMappings() for _, eventClass := range eventSpec { // ...
[ "func", "NewProjectionFromEventSpec", "(", "eventSpec", "types", ".", "EventSpec", ")", "(", "*", "Projection", ",", "error", ")", "{", "// builds abi information from specification", "tables", ":=", "make", "(", "types", ".", "EventTables", ")", "\n\n", "// obtain ...
// NewProjectionFromEventSpec receives a sqlsol event specification // and returns a pointer to a filled projection structure // that contains event types mapped to SQL column types // and Event tables structures with table and columns info
[ "NewProjectionFromEventSpec", "receives", "a", "sqlsol", "event", "specification", "and", "returns", "a", "pointer", "to", "a", "filled", "projection", "structure", "that", "contains", "event", "types", "mapped", "to", "SQL", "column", "types", "and", "Event", "ta...
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/projection.go#L87-L159
train
hyperledger/burrow
vent/sqlsol/projection.go
GetColumn
func (p *Projection) GetColumn(tableName, columnName string) (*types.SQLTableColumn, error) { if table, ok := p.Tables[tableName]; ok { column := table.GetColumn(columnName) if column == nil { return nil, fmt.Errorf("GetColumn: table '%s' has no column '%s'", tableName, columnName) } return column, nil ...
go
func (p *Projection) GetColumn(tableName, columnName string) (*types.SQLTableColumn, error) { if table, ok := p.Tables[tableName]; ok { column := table.GetColumn(columnName) if column == nil { return nil, fmt.Errorf("GetColumn: table '%s' has no column '%s'", tableName, columnName) } return column, nil ...
[ "func", "(", "p", "*", "Projection", ")", "GetColumn", "(", "tableName", ",", "columnName", "string", ")", "(", "*", "types", ".", "SQLTableColumn", ",", "error", ")", "{", "if", "table", ",", "ok", ":=", "p", ".", "Tables", "[", "tableName", "]", ";...
// Get the column for a particular table and column name
[ "Get", "the", "column", "for", "a", "particular", "table", "and", "column", "name" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/projection.go#L162-L173
train
hyperledger/burrow
vent/sqlsol/projection.go
readFile
func readFile(file string) ([]byte, error) { theFile, err := os.Open(file) if err != nil { return nil, err } defer theFile.Close() byteValue, err := ioutil.ReadAll(theFile) if err != nil { return nil, err } return byteValue, nil }
go
func readFile(file string) ([]byte, error) { theFile, err := os.Open(file) if err != nil { return nil, err } defer theFile.Close() byteValue, err := ioutil.ReadAll(theFile) if err != nil { return nil, err } return byteValue, nil }
[ "func", "readFile", "(", "file", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "theFile", ",", "err", ":=", "os", ".", "Open", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", ...
// readFile opens a given file and reads it contents into a stream of bytes
[ "readFile", "opens", "a", "given", "file", "and", "reads", "it", "contents", "into", "a", "stream", "of", "bytes" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/projection.go#L194-L207
train
hyperledger/burrow
vent/sqlsol/projection.go
getSQLType
func getSQLType(evmSignature string, bytesToString bool) (types.SQLColumnType, int, error) { evmSignature = strings.ToLower(evmSignature) re := regexp.MustCompile("[0-9]+") typeSize, _ := strconv.Atoi(re.FindString(evmSignature)) switch { // solidity address => sql varchar case evmSignature == types.EventFieldTy...
go
func getSQLType(evmSignature string, bytesToString bool) (types.SQLColumnType, int, error) { evmSignature = strings.ToLower(evmSignature) re := regexp.MustCompile("[0-9]+") typeSize, _ := strconv.Atoi(re.FindString(evmSignature)) switch { // solidity address => sql varchar case evmSignature == types.EventFieldTy...
[ "func", "getSQLType", "(", "evmSignature", "string", ",", "bytesToString", "bool", ")", "(", "types", ".", "SQLColumnType", ",", "int", ",", "error", ")", "{", "evmSignature", "=", "strings", ".", "ToLower", "(", "evmSignature", ")", "\n", "re", ":=", "reg...
// getSQLType maps event input types with corresponding SQL column types // takes into account related solidity types info and element indexed or hashed
[ "getSQLType", "maps", "event", "input", "types", "with", "corresponding", "SQL", "column", "types", "takes", "into", "account", "related", "solidity", "types", "info", "and", "element", "indexed", "or", "hashed" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/projection.go#L211-L261
train
hyperledger/burrow
vent/sqlsol/projection.go
getGlobalFieldMappings
func getGlobalFieldMappings() []*types.EventFieldMapping { return []*types.EventFieldMapping{ { ColumnName: types.SQLColumnLabelHeight, Field: types.BlockHeightLabel, Type: types.EventFieldTypeString, }, { ColumnName: types.SQLColumnLabelTxHash, Field: types.TxTxHashLabel, Type:...
go
func getGlobalFieldMappings() []*types.EventFieldMapping { return []*types.EventFieldMapping{ { ColumnName: types.SQLColumnLabelHeight, Field: types.BlockHeightLabel, Type: types.EventFieldTypeString, }, { ColumnName: types.SQLColumnLabelTxHash, Field: types.TxTxHashLabel, Type:...
[ "func", "getGlobalFieldMappings", "(", ")", "[", "]", "*", "types", ".", "EventFieldMapping", "{", "return", "[", "]", "*", "types", ".", "EventFieldMapping", "{", "{", "ColumnName", ":", "types", ".", "SQLColumnLabelHeight", ",", "Field", ":", "types", ".",...
// getGlobalColumns returns global columns for event table structures, // these columns will be part of every SQL event table to relate data with source events
[ "getGlobalColumns", "returns", "global", "columns", "for", "event", "table", "structures", "these", "columns", "will", "be", "part", "of", "every", "SQL", "event", "table", "to", "relate", "data", "with", "source", "events" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/projection.go#L265-L288
train
hyperledger/burrow
acm/account.go
Copy
func (acc *Account) Copy() *Account { if acc == nil { return nil } accCopy := *acc accCopy.Permissions.Roles = make([]string, len(acc.Permissions.Roles)) copy(accCopy.Permissions.Roles, acc.Permissions.Roles) return &accCopy }
go
func (acc *Account) Copy() *Account { if acc == nil { return nil } accCopy := *acc accCopy.Permissions.Roles = make([]string, len(acc.Permissions.Roles)) copy(accCopy.Permissions.Roles, acc.Permissions.Roles) return &accCopy }
[ "func", "(", "acc", "*", "Account", ")", "Copy", "(", ")", "*", "Account", "{", "if", "acc", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "accCopy", ":=", "*", "acc", "\n", "accCopy", ".", "Permissions", ".", "Roles", "=", "make", "(", "["...
// Copies all mutable parts of account
[ "Copies", "all", "mutable", "parts", "of", "account" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/account.go#L103-L111
train
hyperledger/burrow
genesis/spec/genesis_spec.go
GenesisDoc
func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient, generateNodeKeys bool) (*genesis.GenesisDoc, error) { genesisDoc := new(genesis.GenesisDoc) if gs.GenesisTime == nil { genesisDoc.GenesisTime = time.Now() } else { genesisDoc.GenesisTime = *gs.GenesisTime } if gs.ChainName == "" { genesisDoc.ChainN...
go
func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient, generateNodeKeys bool) (*genesis.GenesisDoc, error) { genesisDoc := new(genesis.GenesisDoc) if gs.GenesisTime == nil { genesisDoc.GenesisTime = time.Now() } else { genesisDoc.GenesisTime = *gs.GenesisTime } if gs.ChainName == "" { genesisDoc.ChainN...
[ "func", "(", "gs", "*", "GenesisSpec", ")", "GenesisDoc", "(", "keyClient", "keys", ".", "KeyClient", ",", "generateNodeKeys", "bool", ")", "(", "*", "genesis", ".", "GenesisDoc", ",", "error", ")", "{", "genesisDoc", ":=", "new", "(", "genesis", ".", "G...
// Produce a fully realised GenesisDoc from a template GenesisDoc that may omit values
[ "Produce", "a", "fully", "realised", "GenesisDoc", "from", "a", "template", "GenesisDoc", "that", "may", "omit", "values" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/genesis/spec/genesis_spec.go#L50-L106
train
hyperledger/burrow
acm/validator/set.go
SetPower
func (vs *Set) SetPower(id crypto.PublicKey, power *big.Int) error { vs.ChangePower(id, power) return nil }
go
func (vs *Set) SetPower(id crypto.PublicKey, power *big.Int) error { vs.ChangePower(id, power) return nil }
[ "func", "(", "vs", "*", "Set", ")", "SetPower", "(", "id", "crypto", ".", "PublicKey", ",", "power", "*", "big", ".", "Int", ")", "error", "{", "vs", ".", "ChangePower", "(", "id", ",", "power", ")", "\n", "return", "nil", "\n", "}" ]
// Implements Writer, but will never error
[ "Implements", "Writer", "but", "will", "never", "error" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/set.go#L44-L47
train
hyperledger/burrow
acm/validator/set.go
ChangePower
func (vs *Set) ChangePower(id crypto.PublicKey, power *big.Int) *big.Int { address := id.GetAddress() // Calculate flow into this validator (positive means in, negative means out) flow := vs.Flow(id, power) vs.totalPower.Add(vs.totalPower, flow) if vs.trim && power.Sign() == 0 { delete(vs.publicKeys, address) ...
go
func (vs *Set) ChangePower(id crypto.PublicKey, power *big.Int) *big.Int { address := id.GetAddress() // Calculate flow into this validator (positive means in, negative means out) flow := vs.Flow(id, power) vs.totalPower.Add(vs.totalPower, flow) if vs.trim && power.Sign() == 0 { delete(vs.publicKeys, address) ...
[ "func", "(", "vs", "*", "Set", ")", "ChangePower", "(", "id", "crypto", ".", "PublicKey", ",", "power", "*", "big", ".", "Int", ")", "*", "big", ".", "Int", "{", "address", ":=", "id", ".", "GetAddress", "(", ")", "\n", "// Calculate flow into this val...
// Add the power of a validator and returns the flow into that validator
[ "Add", "the", "power", "of", "a", "validator", "and", "returns", "the", "flow", "into", "that", "validator" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/set.go#L50-L64
train
hyperledger/burrow
acm/validator/set.go
Flow
func (vs *Set) Flow(id crypto.PublicKey, power *big.Int) *big.Int { return new(big.Int).Sub(power, vs.GetPower(id.GetAddress())) }
go
func (vs *Set) Flow(id crypto.PublicKey, power *big.Int) *big.Int { return new(big.Int).Sub(power, vs.GetPower(id.GetAddress())) }
[ "func", "(", "vs", "*", "Set", ")", "Flow", "(", "id", "crypto", ".", "PublicKey", ",", "power", "*", "big", ".", "Int", ")", "*", "big", ".", "Int", "{", "return", "new", "(", "big", ".", "Int", ")", ".", "Sub", "(", "power", ",", "vs", ".",...
// Returns the flow that would be induced by a validator power change
[ "Returns", "the", "flow", "that", "would", "be", "induced", "by", "a", "validator", "power", "change" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/set.go#L79-L81
train
hyperledger/burrow
acm/validator/set.go
MaybePower
func (vs *Set) MaybePower(id crypto.Address) *big.Int { if vs.powers[id] == nil { return nil } return new(big.Int).Set(vs.powers[id]) }
go
func (vs *Set) MaybePower(id crypto.Address) *big.Int { if vs.powers[id] == nil { return nil } return new(big.Int).Set(vs.powers[id]) }
[ "func", "(", "vs", "*", "Set", ")", "MaybePower", "(", "id", "crypto", ".", "Address", ")", "*", "big", ".", "Int", "{", "if", "vs", ".", "powers", "[", "id", "]", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "new", "(", "big",...
// Returns the power of id but only if it is set
[ "Returns", "the", "power", "of", "id", "but", "only", "if", "it", "is", "set" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/set.go#L84-L89
train
hyperledger/burrow
acm/validator/set.go
Power
func (vs *Set) Power(id crypto.Address) (*big.Int, error) { return vs.GetPower(id), nil }
go
func (vs *Set) Power(id crypto.Address) (*big.Int, error) { return vs.GetPower(id), nil }
[ "func", "(", "vs", "*", "Set", ")", "Power", "(", "id", "crypto", ".", "Address", ")", "(", "*", "big", ".", "Int", ",", "error", ")", "{", "return", "vs", ".", "GetPower", "(", "id", ")", ",", "nil", "\n", "}" ]
// Version of Power to match interface
[ "Version", "of", "Power", "to", "match", "interface" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/set.go#L92-L94
train
hyperledger/burrow
acm/validator/set.go
Equal
func (vs *Set) Equal(vsOther *Set) error { if vs.Size() != vsOther.Size() { return fmt.Errorf("set size %d != other set size %d", vs.Size(), vsOther.Size()) } // Stop iteration IFF we find a non-matching validator return vs.IterateValidators(func(id crypto.Addressable, power *big.Int) error { otherPower := vsOt...
go
func (vs *Set) Equal(vsOther *Set) error { if vs.Size() != vsOther.Size() { return fmt.Errorf("set size %d != other set size %d", vs.Size(), vsOther.Size()) } // Stop iteration IFF we find a non-matching validator return vs.IterateValidators(func(id crypto.Addressable, power *big.Int) error { otherPower := vsOt...
[ "func", "(", "vs", "*", "Set", ")", "Equal", "(", "vsOther", "*", "Set", ")", "error", "{", "if", "vs", ".", "Size", "(", ")", "!=", "vsOther", ".", "Size", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "vs", ".", "Size...
// Returns an error if the Sets are not equal describing which part of their structures differ
[ "Returns", "an", "error", "if", "the", "Sets", "are", "not", "equal", "describing", "which", "part", "of", "their", "structures", "differ" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/set.go#L105-L117
train
hyperledger/burrow
acm/validator/set.go
IterateValidators
func (vs *Set) IterateValidators(iter func(id crypto.Addressable, power *big.Int) error) error { if vs == nil { return nil } addresses := make(crypto.Addresses, 0, len(vs.powers)) for address := range vs.powers { addresses = append(addresses, address) } sort.Sort(addresses) for _, address := range addresses ...
go
func (vs *Set) IterateValidators(iter func(id crypto.Addressable, power *big.Int) error) error { if vs == nil { return nil } addresses := make(crypto.Addresses, 0, len(vs.powers)) for address := range vs.powers { addresses = append(addresses, address) } sort.Sort(addresses) for _, address := range addresses ...
[ "func", "(", "vs", "*", "Set", ")", "IterateValidators", "(", "iter", "func", "(", "id", "crypto", ".", "Addressable", ",", "power", "*", "big", ".", "Int", ")", "error", ")", "error", "{", "if", "vs", "==", "nil", "{", "return", "nil", "\n", "}", ...
// Iterates over validators sorted by address
[ "Iterates", "over", "validators", "sorted", "by", "address" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/set.go#L120-L136
train
hyperledger/burrow
rpc/rpcevents/blocks.go
Bounds
func (br *BlockRange) Bounds(latestBlockHeight uint64) (startHeight, endHeight uint64, streaming bool) { // End bound is exclusive in state.GetEvents so we increment the height return br.GetStart().Bound(latestBlockHeight), br.GetEnd().Bound(latestBlockHeight) + 1, br.GetEnd().GetType() == Bound_STREAM }
go
func (br *BlockRange) Bounds(latestBlockHeight uint64) (startHeight, endHeight uint64, streaming bool) { // End bound is exclusive in state.GetEvents so we increment the height return br.GetStart().Bound(latestBlockHeight), br.GetEnd().Bound(latestBlockHeight) + 1, br.GetEnd().GetType() == Bound_STREAM }
[ "func", "(", "br", "*", "BlockRange", ")", "Bounds", "(", "latestBlockHeight", "uint64", ")", "(", "startHeight", ",", "endHeight", "uint64", ",", "streaming", "bool", ")", "{", "// End bound is exclusive in state.GetEvents so we increment the height", "return", "br", ...
// Get bounds suitable for events.Provider
[ "Get", "bounds", "suitable", "for", "events", ".", "Provider" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/rpcevents/blocks.go#L8-L12
train
hyperledger/burrow
rpc/jsonrpc.go
NewRPCRequest
func NewRPCRequest(id string, method string, params json.RawMessage) *RPCRequest { return &RPCRequest{ JSONRPC: "2.0", Id: id, Method: method, Params: params, } }
go
func NewRPCRequest(id string, method string, params json.RawMessage) *RPCRequest { return &RPCRequest{ JSONRPC: "2.0", Id: id, Method: method, Params: params, } }
[ "func", "NewRPCRequest", "(", "id", "string", ",", "method", "string", ",", "params", "json", ".", "RawMessage", ")", "*", "RPCRequest", "{", "return", "&", "RPCRequest", "{", "JSONRPC", ":", "\"", "\"", ",", "Id", ":", "id", ",", "Method", ":", "metho...
// Create a new RPC request. This is the generic struct that is passed to RPC // methods
[ "Create", "a", "new", "RPC", "request", ".", "This", "is", "the", "generic", "struct", "that", "is", "passed", "to", "RPC", "methods" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/jsonrpc.go#L76-L83
train
hyperledger/burrow
rpc/jsonrpc.go
NewRPCResponse
func NewRPCResponse(id string, res interface{}) RPCResponse { return RPCResponse(&RPCResultResponse{ Result: res, Id: id, JSONRPC: "2.0", }) }
go
func NewRPCResponse(id string, res interface{}) RPCResponse { return RPCResponse(&RPCResultResponse{ Result: res, Id: id, JSONRPC: "2.0", }) }
[ "func", "NewRPCResponse", "(", "id", "string", ",", "res", "interface", "{", "}", ")", "RPCResponse", "{", "return", "RPCResponse", "(", "&", "RPCResultResponse", "{", "Result", ":", "res", ",", "Id", ":", "id", ",", "JSONRPC", ":", "\"", "\"", ",", "}...
// NewRPCResponse creates a new response object from a result
[ "NewRPCResponse", "creates", "a", "new", "response", "object", "from", "a", "result" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/jsonrpc.go#L86-L92
train
hyperledger/burrow
rpc/jsonrpc.go
NewRPCErrorResponse
func NewRPCErrorResponse(id string, code int, message string) RPCResponse { return RPCResponse(&RPCErrorResponse{ Error: &RPCError{code, message}, Id: id, JSONRPC: "2.0", }) }
go
func NewRPCErrorResponse(id string, code int, message string) RPCResponse { return RPCResponse(&RPCErrorResponse{ Error: &RPCError{code, message}, Id: id, JSONRPC: "2.0", }) }
[ "func", "NewRPCErrorResponse", "(", "id", "string", ",", "code", "int", ",", "message", "string", ")", "RPCResponse", "{", "return", "RPCResponse", "(", "&", "RPCErrorResponse", "{", "Error", ":", "&", "RPCError", "{", "code", ",", "message", "}", ",", "Id...
// NewRPCErrorResponse creates a new error-response object from the error code and message
[ "NewRPCErrorResponse", "creates", "a", "new", "error", "-", "response", "object", "from", "the", "error", "code", "and", "message" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/jsonrpc.go#L95-L101
train
hyperledger/burrow
storage/multi_iterator.go
NewMultiIterator
func NewMultiIterator(reverse bool, iterators ...KVIterator) *MultiIterator { // reuse backing array lessComp := -1 if reverse { lessComp = 1 } mi := &MultiIterator{ iterators: iterators, iteratorOrder: make(map[KVIterator]int), lessComp: lessComp, } mi.init() return mi }
go
func NewMultiIterator(reverse bool, iterators ...KVIterator) *MultiIterator { // reuse backing array lessComp := -1 if reverse { lessComp = 1 } mi := &MultiIterator{ iterators: iterators, iteratorOrder: make(map[KVIterator]int), lessComp: lessComp, } mi.init() return mi }
[ "func", "NewMultiIterator", "(", "reverse", "bool", ",", "iterators", "...", "KVIterator", ")", "*", "MultiIterator", "{", "// reuse backing array", "lessComp", ":=", "-", "1", "\n", "if", "reverse", "{", "lessComp", "=", "1", "\n", "}", "\n", "mi", ":=", ...
// MultiIterator iterates in order over a series o
[ "MultiIterator", "iterates", "in", "order", "over", "a", "series", "o" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/multi_iterator.go#L18-L31
train
hyperledger/burrow
deploy/keys/keys.go
InitKeyClient
func InitKeyClient(keysUrl string) (*LocalKeyClient, error) { aliveCh := make(chan struct{}) localKeyClient, err := keys.NewRemoteKeyClient(keysUrl, logging.NewNoopLogger()) if err != nil { return nil, err } err = localKeyClient.HealthCheck() go func() { for err != nil { err = localKeyClient.HealthCheck(...
go
func InitKeyClient(keysUrl string) (*LocalKeyClient, error) { aliveCh := make(chan struct{}) localKeyClient, err := keys.NewRemoteKeyClient(keysUrl, logging.NewNoopLogger()) if err != nil { return nil, err } err = localKeyClient.HealthCheck() go func() { for err != nil { err = localKeyClient.HealthCheck(...
[ "func", "InitKeyClient", "(", "keysUrl", "string", ")", "(", "*", "LocalKeyClient", ",", "error", ")", "{", "aliveCh", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "localKeyClient", ",", "err", ":=", "keys", ".", "NewRemoteKeyClient", "(", "...
// Returns an initialized key client to a docker container // running the keys server // Adding the Ip address is optional and should only be used // for passing data
[ "Returns", "an", "initialized", "key", "client", "to", "a", "docker", "container", "running", "the", "keys", "server", "Adding", "the", "Ip", "address", "is", "optional", "and", "should", "only", "be", "used", "for", "passing", "data" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/keys/keys.go#L22-L43
train
hyperledger/burrow
storage/kvstore.go
NormaliseDomain
func NormaliseDomain(low, high []byte) ([]byte, []byte) { if len(low) == 0 { low = []byte{} } return low, high }
go
func NormaliseDomain(low, high []byte) ([]byte, []byte) { if len(low) == 0 { low = []byte{} } return low, high }
[ "func", "NormaliseDomain", "(", "low", ",", "high", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ")", "{", "if", "len", "(", "low", ")", "==", "0", "{", "low", "=", "[", "]", "byte", "{", "}", "\n", "}", "\n", "retur...
// NormaliseDomain encodes the assumption that when nil is used as a lower bound is interpreted as low rather than high
[ "NormaliseDomain", "encodes", "the", "assumption", "that", "when", "nil", "is", "used", "as", "a", "lower", "bound", "is", "interpreted", "as", "low", "rather", "than", "high" ]
59993f5aad71a8e16ab6ed4e57e138e2398eae4e
https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/kvstore.go#L83-L88
train