id int32 0 167k | 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 listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,100 | 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 |
27,101 | 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 |
27,102 | 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 |
27,103 | 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 |
27,104 | 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 |
27,105 | 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 |
27,106 | 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 |
27,107 | 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 |
27,108 | 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 |
27,109 | 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 |
27,110 | 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 |
27,111 | 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 |
27,112 | 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 |
27,113 | 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 |
27,114 | 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 |
27,115 | 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 |
27,116 | 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 |
27,117 | 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 |
27,118 | 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 |
27,119 | 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 |
27,120 | 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 |
27,121 | 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 |
27,122 | 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 |
27,123 | 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 |
27,124 | 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 |
27,125 | 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 |
27,126 | 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 |
27,127 | 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 |
27,128 | 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 |
27,129 | 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 |
27,130 | 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 |
27,131 | 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 |
27,132 | 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 |
27,133 | 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 |
27,134 | 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 |
27,135 | 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 |
27,136 | 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 |
27,137 | 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 |
27,138 | 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 |
27,139 | 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 |
27,140 | 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 |
27,141 | 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 |
27,142 | 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 |
27,143 | 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 |
27,144 | 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 |
27,145 | 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 |
27,146 | 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 |
27,147 | 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 |
27,148 | 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 |
27,149 | 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 |
27,150 | 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 |
27,151 | 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 |
27,152 | 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 |
27,153 | 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 |
27,154 | 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 |
27,155 | 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 |
27,156 | 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 |
27,157 | 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 |
27,158 | 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 |
27,159 | 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 |
27,160 | 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 |
27,161 | 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 |
27,162 | 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 |
27,163 | 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 |
27,164 | 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 |
27,165 | 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 |
27,166 | 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 |
27,167 | 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 |
27,168 | 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 |
27,169 | 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 |
27,170 | 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 |
27,171 | 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 |
27,172 | 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 |
27,173 | 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 |
27,174 | 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 |
27,175 | 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 |
27,176 | hyperledger/burrow | storage/kvstore.go | CompareKeys | func CompareKeys(k1, k2 []byte) int {
ko1 := KeyOrder(k1)
ko2 := KeyOrder(k2)
if ko1 < ko2 {
return -1
}
if ko1 > ko2 {
return 1
}
return bytes.Compare(k1, k2)
} | go | func CompareKeys(k1, k2 []byte) int {
ko1 := KeyOrder(k1)
ko2 := KeyOrder(k2)
if ko1 < ko2 {
return -1
}
if ko1 > ko2 {
return 1
}
return bytes.Compare(k1, k2)
} | [
"func",
"CompareKeys",
"(",
"k1",
",",
"k2",
"[",
"]",
"byte",
")",
"int",
"{",
"ko1",
":=",
"KeyOrder",
"(",
"k1",
")",
"\n",
"ko2",
":=",
"KeyOrder",
"(",
"k2",
")",
"\n",
"if",
"ko1",
"<",
"ko2",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n",
"... | // Sorts the keys as if they were compared lexicographically with their KeyOrder prepended | [
"Sorts",
"the",
"keys",
"as",
"if",
"they",
"were",
"compared",
"lexicographically",
"with",
"their",
"KeyOrder",
"prepended"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/kvstore.go#L106-L116 |
27,177 | hyperledger/burrow | execution/evm/vm.go | delegateCall | func (vm *VM) delegateCall(callState Interface, eventSink EventSink, caller, callee crypto.Address,
code, input []byte, value uint64, gas *uint64,
callType exec.CallType) (output []byte, err errors.CodedError) {
// fire the post call event (including exception if applicable) and make sure we return the accumulated ... | go | func (vm *VM) delegateCall(callState Interface, eventSink EventSink, caller, callee crypto.Address,
code, input []byte, value uint64, gas *uint64,
callType exec.CallType) (output []byte, err errors.CodedError) {
// fire the post call event (including exception if applicable) and make sure we return the accumulated ... | [
"func",
"(",
"vm",
"*",
"VM",
")",
"delegateCall",
"(",
"callState",
"Interface",
",",
"eventSink",
"EventSink",
",",
"caller",
",",
"callee",
"crypto",
".",
"Address",
",",
"code",
",",
"input",
"[",
"]",
"byte",
",",
"value",
"uint64",
",",
"gas",
"*... | // DelegateCall is executed by the DELEGATECALL opcode, introduced as off Ethereum Homestead.
// The intent of delegate call is to run the code of the callee in the storage context of the caller;
// while preserving the original caller to the previous callee.
// Different to the normal CALL or CALLCODE, the value does ... | [
"DelegateCall",
"is",
"executed",
"by",
"the",
"DELEGATECALL",
"opcode",
"introduced",
"as",
"off",
"Ethereum",
"Homestead",
".",
"The",
"intent",
"of",
"delegate",
"call",
"is",
"to",
"run",
"the",
"code",
"of",
"the",
"callee",
"in",
"the",
"storage",
"con... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/vm.go#L188-L213 |
27,178 | hyperledger/burrow | execution/evm/vm.go | useGasNegative | func useGasNegative(gasLeft *uint64, gasToUse uint64, err errors.Sink) {
if *gasLeft >= gasToUse {
*gasLeft -= gasToUse
} else {
err.PushError(errors.ErrorCodeInsufficientGas)
}
} | go | func useGasNegative(gasLeft *uint64, gasToUse uint64, err errors.Sink) {
if *gasLeft >= gasToUse {
*gasLeft -= gasToUse
} else {
err.PushError(errors.ErrorCodeInsufficientGas)
}
} | [
"func",
"useGasNegative",
"(",
"gasLeft",
"*",
"uint64",
",",
"gasToUse",
"uint64",
",",
"err",
"errors",
".",
"Sink",
")",
"{",
"if",
"*",
"gasLeft",
">=",
"gasToUse",
"{",
"*",
"gasLeft",
"-=",
"gasToUse",
"\n",
"}",
"else",
"{",
"err",
".",
"PushErr... | // Try to deduct gasToUse from gasLeft. If ok return false, otherwise
// set err and return true. | [
"Try",
"to",
"deduct",
"gasToUse",
"from",
"gasLeft",
".",
"If",
"ok",
"return",
"false",
"otherwise",
"set",
"err",
"and",
"return",
"true",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/vm.go#L217-L223 |
27,179 | hyperledger/burrow | execution/evm/vm.go | dumpTokens | func dumpTokens(nonce []byte, caller, callee crypto.Address, code []byte) {
var tokensString string
tokens, err := acm.Bytecode(code).Tokens()
if err != nil {
tokensString = fmt.Sprintf("error generating tokens from bytecode: %v", err)
} else {
tokensString = strings.Join(tokens, "\n")
}
txHashString := "nil-... | go | func dumpTokens(nonce []byte, caller, callee crypto.Address, code []byte) {
var tokensString string
tokens, err := acm.Bytecode(code).Tokens()
if err != nil {
tokensString = fmt.Sprintf("error generating tokens from bytecode: %v", err)
} else {
tokensString = strings.Join(tokens, "\n")
}
txHashString := "nil-... | [
"func",
"dumpTokens",
"(",
"nonce",
"[",
"]",
"byte",
",",
"caller",
",",
"callee",
"crypto",
".",
"Address",
",",
"code",
"[",
"]",
"byte",
")",
"{",
"var",
"tokensString",
"string",
"\n",
"tokens",
",",
"err",
":=",
"acm",
".",
"Bytecode",
"(",
"co... | // Dump the bytecode being sent to the EVM in the current working directory | [
"Dump",
"the",
"bytecode",
"being",
"sent",
"to",
"the",
"EVM",
"in",
"the",
"current",
"working",
"directory"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/vm.go#L1064-L1086 |
27,180 | hyperledger/burrow | integration/integration.go | MakePrivateAccounts | func MakePrivateAccounts(n int) []*acm.PrivateAccount {
accounts := make([]*acm.PrivateAccount, n)
for i := 0; i < n; i++ {
accounts[i] = acm.GeneratePrivateAccountFromSecret("mysecret" + strconv.Itoa(i))
}
return accounts
} | go | func MakePrivateAccounts(n int) []*acm.PrivateAccount {
accounts := make([]*acm.PrivateAccount, n)
for i := 0; i < n; i++ {
accounts[i] = acm.GeneratePrivateAccountFromSecret("mysecret" + strconv.Itoa(i))
}
return accounts
} | [
"func",
"MakePrivateAccounts",
"(",
"n",
"int",
")",
"[",
"]",
"*",
"acm",
".",
"PrivateAccount",
"{",
"accounts",
":=",
"make",
"(",
"[",
"]",
"*",
"acm",
".",
"PrivateAccount",
",",
"n",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";"... | // Deterministic account generation helper. Pass number of accounts to make | [
"Deterministic",
"account",
"generation",
"helper",
".",
"Pass",
"number",
"of",
"accounts",
"to",
"make"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/integration/integration.go#L190-L196 |
27,181 | hyperledger/burrow | vent/sqldb/adapters/postgres_adapter.go | NewPostgresAdapter | func NewPostgresAdapter(schema string, log *logger.Logger) *PostgresAdapter {
return &PostgresAdapter{
Log: log,
Schema: schema,
}
} | go | func NewPostgresAdapter(schema string, log *logger.Logger) *PostgresAdapter {
return &PostgresAdapter{
Log: log,
Schema: schema,
}
} | [
"func",
"NewPostgresAdapter",
"(",
"schema",
"string",
",",
"log",
"*",
"logger",
".",
"Logger",
")",
"*",
"PostgresAdapter",
"{",
"return",
"&",
"PostgresAdapter",
"{",
"Log",
":",
"log",
",",
"Schema",
":",
"schema",
",",
"}",
"\n",
"}"
] | // NewPostgresAdapter constructs a new db adapter | [
"NewPostgresAdapter",
"constructs",
"a",
"new",
"db",
"adapter"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/postgres_adapter.go#L33-L38 |
27,182 | hyperledger/burrow | vent/sqldb/adapters/postgres_adapter.go | Open | func (adapter *PostgresAdapter) Open(dbURL string) (*sql.DB, error) {
db, err := sql.Open("postgres", dbURL)
if err != nil {
adapter.Log.Info("msg", "Error creating database connection", "err", err)
return nil, err
}
// if there is a supplied Schema
if adapter.Schema != "" {
if err = db.Ping(); err != nil {... | go | func (adapter *PostgresAdapter) Open(dbURL string) (*sql.DB, error) {
db, err := sql.Open("postgres", dbURL)
if err != nil {
adapter.Log.Info("msg", "Error creating database connection", "err", err)
return nil, err
}
// if there is a supplied Schema
if adapter.Schema != "" {
if err = db.Ping(); err != nil {... | [
"func",
"(",
"adapter",
"*",
"PostgresAdapter",
")",
"Open",
"(",
"dbURL",
"string",
")",
"(",
"*",
"sql",
".",
"DB",
",",
"error",
")",
"{",
"db",
",",
"err",
":=",
"sql",
".",
"Open",
"(",
"\"",
"\"",
",",
"dbURL",
")",
"\n",
"if",
"err",
"!=... | // Open connects to a PostgreSQL database, opens it & create default schema if provided | [
"Open",
"connects",
"to",
"a",
"PostgreSQL",
"database",
"opens",
"it",
"&",
"create",
"default",
"schema",
"if",
"provided"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/postgres_adapter.go#L41-L84 |
27,183 | hyperledger/burrow | vent/sqldb/adapters/postgres_adapter.go | CreateTableQuery | func (adapter *PostgresAdapter) CreateTableQuery(tableName string, columns []*types.SQLTableColumn) (string, string) {
// build query
columnsDef := ""
primaryKey := ""
dictionaryValues := ""
for i, column := range columns {
secureColumn := adapter.SecureName(column.Name)
sqlType, _ := adapter.TypeMapping(colu... | go | func (adapter *PostgresAdapter) CreateTableQuery(tableName string, columns []*types.SQLTableColumn) (string, string) {
// build query
columnsDef := ""
primaryKey := ""
dictionaryValues := ""
for i, column := range columns {
secureColumn := adapter.SecureName(column.Name)
sqlType, _ := adapter.TypeMapping(colu... | [
"func",
"(",
"adapter",
"*",
"PostgresAdapter",
")",
"CreateTableQuery",
"(",
"tableName",
"string",
",",
"columns",
"[",
"]",
"*",
"types",
".",
"SQLTableColumn",
")",
"(",
"string",
",",
"string",
")",
"{",
"// build query",
"columnsDef",
":=",
"\"",
"\"",... | // CreateTableQuery builds query for creating a new table | [
"CreateTableQuery",
"builds",
"query",
"for",
"creating",
"a",
"new",
"table"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/postgres_adapter.go#L101-L155 |
27,184 | hyperledger/burrow | vent/sqldb/adapters/postgres_adapter.go | TableDefinitionQuery | func (adapter *PostgresAdapter) TableDefinitionQuery() string {
query := `
SELECT
%s,%s,%s,%s
FROM
%s.%s
WHERE
%s = $1
ORDER BY
%s;`
return Cleanf(query,
types.SQLColumnLabelColumnName, types.SQLColumnLabelColumnType, // select
types.SQLColumnLabelColumnLength, types.SQLColumnLabelPrimaryKey,... | go | func (adapter *PostgresAdapter) TableDefinitionQuery() string {
query := `
SELECT
%s,%s,%s,%s
FROM
%s.%s
WHERE
%s = $1
ORDER BY
%s;`
return Cleanf(query,
types.SQLColumnLabelColumnName, types.SQLColumnLabelColumnType, // select
types.SQLColumnLabelColumnLength, types.SQLColumnLabelPrimaryKey,... | [
"func",
"(",
"adapter",
"*",
"PostgresAdapter",
")",
"TableDefinitionQuery",
"(",
")",
"string",
"{",
"query",
":=",
"`\n\t\tSELECT\n\t\t\t%s,%s,%s,%s\n\t\tFROM\n\t\t\t%s.%s\n\t\tWHERE\n\t\t\t%s = $1\n\t\tORDER BY\n\t\t\t%s;`",
"\n\n",
"return",
"Cleanf",
"(",
"query",
",",
"... | // TableDefinitionQuery returns a query with table structure | [
"TableDefinitionQuery",
"returns",
"a",
"query",
"with",
"table",
"structure"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/postgres_adapter.go#L187-L205 |
27,185 | hyperledger/burrow | vent/sqldb/adapters/postgres_adapter.go | InsertLogQuery | func (adapter *PostgresAdapter) InsertLogQuery() string {
query := `
INSERT INTO %s.%s (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
VALUES (CURRENT_TIMESTAMP, $1, $2, $3, $4, $5, $6 ,$7, $8, $9);`
return Cleanf(query,
adapter.Schema, types.SQLLogTableName, // insert
//fields
types.SQLColumnLabelTimeStamp, types.SQLColu... | go | func (adapter *PostgresAdapter) InsertLogQuery() string {
query := `
INSERT INTO %s.%s (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
VALUES (CURRENT_TIMESTAMP, $1, $2, $3, $4, $5, $6 ,$7, $8, $9);`
return Cleanf(query,
adapter.Schema, types.SQLLogTableName, // insert
//fields
types.SQLColumnLabelTimeStamp, types.SQLColu... | [
"func",
"(",
"adapter",
"*",
"PostgresAdapter",
")",
"InsertLogQuery",
"(",
")",
"string",
"{",
"query",
":=",
"`\n\t\tINSERT INTO %s.%s (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)\n\t\tVALUES (CURRENT_TIMESTAMP, $1, $2, $3, $4, $5, $6 ,$7, $8, $9);`",
"\n\n",
"return",
"Cleanf",
"(",
"query... | // InsertLogQuery returns a query to insert a row in log table | [
"InsertLogQuery",
"returns",
"a",
"query",
"to",
"insert",
"a",
"row",
"in",
"log",
"table"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/adapters/postgres_adapter.go#L256-L267 |
27,186 | hyperledger/burrow | consensus/abci/process.go | NewProcess | func NewProcess(committer execution.BatchCommitter, blockchain *bcm.Blockchain, txDecoder txs.Decoder,
commitInterval time.Duration, panicFunc func(error)) *Process {
p := &Process{
committer: committer,
blockchain: blockchain,
done: make(chan struct{}),
txDecoder: txDecoder,
panic: panicFunc,... | go | func NewProcess(committer execution.BatchCommitter, blockchain *bcm.Blockchain, txDecoder txs.Decoder,
commitInterval time.Duration, panicFunc func(error)) *Process {
p := &Process{
committer: committer,
blockchain: blockchain,
done: make(chan struct{}),
txDecoder: txDecoder,
panic: panicFunc,... | [
"func",
"NewProcess",
"(",
"committer",
"execution",
".",
"BatchCommitter",
",",
"blockchain",
"*",
"bcm",
".",
"Blockchain",
",",
"txDecoder",
"txs",
".",
"Decoder",
",",
"commitInterval",
"time",
".",
"Duration",
",",
"panicFunc",
"func",
"(",
"error",
")",
... | // NewProcess returns a no-consensus ABCI process suitable for running a single node without Tendermint.
// The CheckTx function can be used to submit transactions which are processed according | [
"NewProcess",
"returns",
"a",
"no",
"-",
"consensus",
"ABCI",
"process",
"suitable",
"for",
"running",
"a",
"single",
"node",
"without",
"Tendermint",
".",
"The",
"CheckTx",
"function",
"can",
"be",
"used",
"to",
"submit",
"transactions",
"which",
"are",
"proc... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/consensus/abci/process.go#L31-L48 |
27,187 | hyperledger/burrow | txs/tx.go | Sign | func (tx *Tx) Sign(signingAccounts ...acm.AddressableSigner) (*Envelope, error) {
env := tx.Enclose()
err := env.Sign(signingAccounts...)
if err != nil {
return nil, err
}
tx.Rehash()
return env, nil
} | go | func (tx *Tx) Sign(signingAccounts ...acm.AddressableSigner) (*Envelope, error) {
env := tx.Enclose()
err := env.Sign(signingAccounts...)
if err != nil {
return nil, err
}
tx.Rehash()
return env, nil
} | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"Sign",
"(",
"signingAccounts",
"...",
"acm",
".",
"AddressableSigner",
")",
"(",
"*",
"Envelope",
",",
"error",
")",
"{",
"env",
":=",
"tx",
".",
"Enclose",
"(",
")",
"\n",
"err",
":=",
"env",
".",
"Sign",
"(",
... | // Encloses in Envelope and signs envelope | [
"Encloses",
"in",
"Envelope",
"and",
"signs",
"envelope"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/txs/tx.go#L56-L64 |
27,188 | hyperledger/burrow | txs/tx.go | MustSignBytes | func (tx *Tx) MustSignBytes() []byte {
bs, err := tx.SignBytes()
if err != nil {
panic(err)
}
return bs
} | go | func (tx *Tx) MustSignBytes() []byte {
bs, err := tx.SignBytes()
if err != nil {
panic(err)
}
return bs
} | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"MustSignBytes",
"(",
")",
"[",
"]",
"byte",
"{",
"bs",
",",
"err",
":=",
"tx",
".",
"SignBytes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"bs",
"\n... | // Generate SignBytes, panicking on any failure | [
"Generate",
"SignBytes",
"panicking",
"on",
"any",
"failure"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/txs/tx.go#L67-L73 |
27,189 | hyperledger/burrow | txs/tx.go | GenerateReceipt | func (tx *Tx) GenerateReceipt() *Receipt {
receipt := &Receipt{
TxType: tx.Type(),
TxHash: tx.Hash(),
}
if callTx, ok := tx.Payload.(*payload.CallTx); ok {
receipt.CreatesContract = callTx.Address == nil
if receipt.CreatesContract {
receipt.ContractAddress = crypto.NewContractAddress(callTx.Input.Address,... | go | func (tx *Tx) GenerateReceipt() *Receipt {
receipt := &Receipt{
TxType: tx.Type(),
TxHash: tx.Hash(),
}
if callTx, ok := tx.Payload.(*payload.CallTx); ok {
receipt.CreatesContract = callTx.Address == nil
if receipt.CreatesContract {
receipt.ContractAddress = crypto.NewContractAddress(callTx.Input.Address,... | [
"func",
"(",
"tx",
"*",
"Tx",
")",
"GenerateReceipt",
"(",
")",
"*",
"Receipt",
"{",
"receipt",
":=",
"&",
"Receipt",
"{",
"TxType",
":",
"tx",
".",
"Type",
"(",
")",
",",
"TxHash",
":",
"tx",
".",
"Hash",
"(",
")",
",",
"}",
"\n",
"if",
"callT... | // Generate a transaction Receipt containing the Tx hash and other information if the Tx is call.
// Returned by ABCI methods. | [
"Generate",
"a",
"transaction",
"Receipt",
"containing",
"the",
"Tx",
"hash",
"and",
"other",
"information",
"if",
"the",
"Tx",
"is",
"call",
".",
"Returned",
"by",
"ABCI",
"methods",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/txs/tx.go#L184-L198 |
27,190 | hyperledger/burrow | logging/loggers/filter_logger.go | FilterLogger | func FilterLogger(outputLogger log.Logger, predicate func(keyvals []interface{}) bool) log.Logger {
return log.LoggerFunc(func(keyvals ...interface{}) error {
// Always forward signals
if structure.Signal(keyvals) != "" || !predicate(keyvals) {
return outputLogger.Log(keyvals...)
}
return nil
})
} | go | func FilterLogger(outputLogger log.Logger, predicate func(keyvals []interface{}) bool) log.Logger {
return log.LoggerFunc(func(keyvals ...interface{}) error {
// Always forward signals
if structure.Signal(keyvals) != "" || !predicate(keyvals) {
return outputLogger.Log(keyvals...)
}
return nil
})
} | [
"func",
"FilterLogger",
"(",
"outputLogger",
"log",
".",
"Logger",
",",
"predicate",
"func",
"(",
"keyvals",
"[",
"]",
"interface",
"{",
"}",
")",
"bool",
")",
"log",
".",
"Logger",
"{",
"return",
"log",
".",
"LoggerFunc",
"(",
"func",
"(",
"keyvals",
... | // Filter logger allows us to filter lines logged to it before passing on to underlying
// output logger
// Creates a logger that removes lines from output when the predicate evaluates true | [
"Filter",
"logger",
"allows",
"us",
"to",
"filter",
"lines",
"logged",
"to",
"it",
"before",
"passing",
"on",
"to",
"underlying",
"output",
"logger",
"Creates",
"a",
"logger",
"that",
"removes",
"lines",
"from",
"output",
"when",
"the",
"predicate",
"evaluates... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/filter_logger.go#L11-L19 |
27,191 | hyperledger/burrow | deploy/def/client.go | dial | func (c *Client) dial(logger *logging.Logger) error {
if c.transactClient == nil {
conn, err := grpc.Dial(c.ChainAddress, grpc.WithInsecure())
if err != nil {
return err
}
c.transactClient = rpctransact.NewTransactClient(conn)
c.queryClient = rpcquery.NewQueryClient(conn)
c.executionEventsClient = rpcev... | go | func (c *Client) dial(logger *logging.Logger) error {
if c.transactClient == nil {
conn, err := grpc.Dial(c.ChainAddress, grpc.WithInsecure())
if err != nil {
return err
}
c.transactClient = rpctransact.NewTransactClient(conn)
c.queryClient = rpcquery.NewQueryClient(conn)
c.executionEventsClient = rpcev... | [
"func",
"(",
"c",
"*",
"Client",
")",
"dial",
"(",
"logger",
"*",
"logging",
".",
"Logger",
")",
"error",
"{",
"if",
"c",
".",
"transactClient",
"==",
"nil",
"{",
"conn",
",",
"err",
":=",
"grpc",
".",
"Dial",
"(",
"c",
".",
"ChainAddress",
",",
... | // Connect GRPC clients using ChainURL | [
"Connect",
"GRPC",
"clients",
"using",
"ChainURL"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/def/client.go#L58-L89 |
27,192 | hyperledger/burrow | deploy/def/client.go | CreateKey | func (c *Client) CreateKey(keyName, curveTypeString string, logger *logging.Logger) (crypto.PublicKey, error) {
err := c.dial(logger)
if err != nil {
return crypto.PublicKey{}, err
}
if c.keyClient == nil {
return crypto.PublicKey{}, fmt.Errorf("could not create key pair since no keys service is attached, " +
... | go | func (c *Client) CreateKey(keyName, curveTypeString string, logger *logging.Logger) (crypto.PublicKey, error) {
err := c.dial(logger)
if err != nil {
return crypto.PublicKey{}, err
}
if c.keyClient == nil {
return crypto.PublicKey{}, fmt.Errorf("could not create key pair since no keys service is attached, " +
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateKey",
"(",
"keyName",
",",
"curveTypeString",
"string",
",",
"logger",
"*",
"logging",
".",
"Logger",
")",
"(",
"crypto",
".",
"PublicKey",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"dial",
"(",
"logg... | // Creates a keypair using attached keys service | [
"Creates",
"a",
"keypair",
"using",
"attached",
"keys",
"service"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/def/client.go#L238-L259 |
27,193 | hyperledger/burrow | deploy/def/client.go | Broadcast | func (c *Client) Broadcast(tx payload.Payload, logger *logging.Logger) (*exec.TxExecution, error) {
err := c.dial(logger)
if err != nil {
return nil, err
}
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
return c.transactClient.BroadcastTxSync(ctx, &rpctransact.TxEnvelopeParam... | go | func (c *Client) Broadcast(tx payload.Payload, logger *logging.Logger) (*exec.TxExecution, error) {
err := c.dial(logger)
if err != nil {
return nil, err
}
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
return c.transactClient.BroadcastTxSync(ctx, &rpctransact.TxEnvelopeParam... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Broadcast",
"(",
"tx",
"payload",
".",
"Payload",
",",
"logger",
"*",
"logging",
".",
"Logger",
")",
"(",
"*",
"exec",
".",
"TxExecution",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"dial",
"(",
"logger",
... | // Broadcast payload for remote signing | [
"Broadcast",
"payload",
"for",
"remote",
"signing"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/def/client.go#L262-L270 |
27,194 | hyperledger/burrow | deploy/def/client.go | BroadcastEnvelope | func (c *Client) BroadcastEnvelope(txEnv *txs.Envelope, logger *logging.Logger) (*exec.TxExecution, error) {
err := c.dial(logger)
if err != nil {
return nil, err
}
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
return c.transactClient.BroadcastTxSync(ctx, &rpctransact.TxEnv... | go | func (c *Client) BroadcastEnvelope(txEnv *txs.Envelope, logger *logging.Logger) (*exec.TxExecution, error) {
err := c.dial(logger)
if err != nil {
return nil, err
}
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
return c.transactClient.BroadcastTxSync(ctx, &rpctransact.TxEnv... | [
"func",
"(",
"c",
"*",
"Client",
")",
"BroadcastEnvelope",
"(",
"txEnv",
"*",
"txs",
".",
"Envelope",
",",
"logger",
"*",
"logging",
".",
"Logger",
")",
"(",
"*",
"exec",
".",
"TxExecution",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"dial",
"(... | // Broadcast envelope - can be locally signed or remote signing will be attempted | [
"Broadcast",
"envelope",
"-",
"can",
"be",
"locally",
"signed",
"or",
"remote",
"signing",
"will",
"be",
"attempted"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/def/client.go#L273-L282 |
27,195 | hyperledger/burrow | core/processes.go | NoConsensusLauncher | func NoConsensusLauncher(kern *Kernel) process.Launcher {
return process.Launcher{
Name: NoConsensusProcessName,
Enabled: kern.Node == nil,
Launch: func() (process.Process, error) {
accountState := kern.State
nameRegState := kern.State
kern.Service = rpc.NewService(accountState, nameRegState, kern.Bl... | go | func NoConsensusLauncher(kern *Kernel) process.Launcher {
return process.Launcher{
Name: NoConsensusProcessName,
Enabled: kern.Node == nil,
Launch: func() (process.Process, error) {
accountState := kern.State
nameRegState := kern.State
kern.Service = rpc.NewService(accountState, nameRegState, kern.Bl... | [
"func",
"NoConsensusLauncher",
"(",
"kern",
"*",
"Kernel",
")",
"process",
".",
"Launcher",
"{",
"return",
"process",
".",
"Launcher",
"{",
"Name",
":",
"NoConsensusProcessName",
",",
"Enabled",
":",
"kern",
".",
"Node",
"==",
"nil",
",",
"Launch",
":",
"f... | // Run a single uncoordinated local state | [
"Run",
"a",
"single",
"uncoordinated",
"local",
"state"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/processes.go#L87-L107 |
27,196 | hyperledger/burrow | acm/private_account.go | SigningAccounts | func SigningAccounts(concretePrivateAccounts []*PrivateAccount) []AddressableSigner {
signingAccounts := make([]AddressableSigner, len(concretePrivateAccounts))
for i, cpa := range concretePrivateAccounts {
signingAccounts[i] = cpa
}
return signingAccounts
} | go | func SigningAccounts(concretePrivateAccounts []*PrivateAccount) []AddressableSigner {
signingAccounts := make([]AddressableSigner, len(concretePrivateAccounts))
for i, cpa := range concretePrivateAccounts {
signingAccounts[i] = cpa
}
return signingAccounts
} | [
"func",
"SigningAccounts",
"(",
"concretePrivateAccounts",
"[",
"]",
"*",
"PrivateAccount",
")",
"[",
"]",
"AddressableSigner",
"{",
"signingAccounts",
":=",
"make",
"(",
"[",
"]",
"AddressableSigner",
",",
"len",
"(",
"concretePrivateAccounts",
")",
")",
"\n",
... | // Convert slice of ConcretePrivateAccounts to slice of SigningAccounts | [
"Convert",
"slice",
"of",
"ConcretePrivateAccounts",
"to",
"slice",
"of",
"SigningAccounts"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/private_account.go#L99-L105 |
27,197 | hyperledger/burrow | acm/private_account.go | GeneratePrivateAccount | func GeneratePrivateAccount() (*PrivateAccount, error) {
privateKey, err := crypto.GeneratePrivateKey(nil, crypto.CurveTypeEd25519)
if err != nil {
return nil, err
}
publicKey := privateKey.GetPublicKey()
return ConcretePrivateAccount{
Address: publicKey.GetAddress(),
PublicKey: publicKey,
PrivateKey: ... | go | func GeneratePrivateAccount() (*PrivateAccount, error) {
privateKey, err := crypto.GeneratePrivateKey(nil, crypto.CurveTypeEd25519)
if err != nil {
return nil, err
}
publicKey := privateKey.GetPublicKey()
return ConcretePrivateAccount{
Address: publicKey.GetAddress(),
PublicKey: publicKey,
PrivateKey: ... | [
"func",
"GeneratePrivateAccount",
"(",
")",
"(",
"*",
"PrivateAccount",
",",
"error",
")",
"{",
"privateKey",
",",
"err",
":=",
"crypto",
".",
"GeneratePrivateKey",
"(",
"nil",
",",
"crypto",
".",
"CurveTypeEd25519",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // Generates a new account with private key. | [
"Generates",
"a",
"new",
"account",
"with",
"private",
"key",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/private_account.go#L108-L119 |
27,198 | hyperledger/burrow | acm/private_account.go | GeneratePrivateAccountFromSecret | func GeneratePrivateAccountFromSecret(secret string) *PrivateAccount {
privateKey := crypto.PrivateKeyFromSecret(secret, crypto.CurveTypeEd25519)
publicKey := privateKey.GetPublicKey()
return ConcretePrivateAccount{
Address: publicKey.GetAddress(),
PublicKey: publicKey,
PrivateKey: privateKey,
}.PrivateAc... | go | func GeneratePrivateAccountFromSecret(secret string) *PrivateAccount {
privateKey := crypto.PrivateKeyFromSecret(secret, crypto.CurveTypeEd25519)
publicKey := privateKey.GetPublicKey()
return ConcretePrivateAccount{
Address: publicKey.GetAddress(),
PublicKey: publicKey,
PrivateKey: privateKey,
}.PrivateAc... | [
"func",
"GeneratePrivateAccountFromSecret",
"(",
"secret",
"string",
")",
"*",
"PrivateAccount",
"{",
"privateKey",
":=",
"crypto",
".",
"PrivateKeyFromSecret",
"(",
"secret",
",",
"crypto",
".",
"CurveTypeEd25519",
")",
"\n",
"publicKey",
":=",
"privateKey",
".",
... | // Generates a new account with private key from SHA256 hash of a secret | [
"Generates",
"a",
"new",
"account",
"with",
"private",
"key",
"from",
"SHA256",
"hash",
"of",
"a",
"secret"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/private_account.go#L122-L130 |
27,199 | hyperledger/burrow | cmd/burrow/commands/snatives.go | Snatives | func Snatives(output Output) func(cmd *cli.Cmd) {
return func(cmd *cli.Cmd) {
contractsOpt := cmd.StringsOpt("c contracts", nil, "Contracts to generate")
cmd.Action = func() {
contracts := evm.SNativeContracts()
// Index of next contract
i := 1
for _, contract := range contracts {
if len(*contracts... | go | func Snatives(output Output) func(cmd *cli.Cmd) {
return func(cmd *cli.Cmd) {
contractsOpt := cmd.StringsOpt("c contracts", nil, "Contracts to generate")
cmd.Action = func() {
contracts := evm.SNativeContracts()
// Index of next contract
i := 1
for _, contract := range contracts {
if len(*contracts... | [
"func",
"Snatives",
"(",
"output",
"Output",
")",
"func",
"(",
"cmd",
"*",
"cli",
".",
"Cmd",
")",
"{",
"return",
"func",
"(",
"cmd",
"*",
"cli",
".",
"Cmd",
")",
"{",
"contractsOpt",
":=",
"cmd",
".",
"StringsOpt",
"(",
"\"",
"\"",
",",
"nil",
"... | // Dump SNative contracts | [
"Dump",
"SNative",
"contracts"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/cmd/burrow/commands/snatives.go#L27-L62 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.