repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
hyperledger/burrow | util/slice/slice.go | DeepFlatten | func DeepFlatten(slice []interface{}, depth int) []interface{} {
if depth == 0 {
return slice
}
returnSlice := []interface{}{}
for _, element := range slice {
if s, ok := element.([]interface{}); ok {
returnSlice = append(returnSlice, DeepFlatten(s, depth-1)...)
} else {
returnSlice = append(returnSlic... | go | func DeepFlatten(slice []interface{}, depth int) []interface{} {
if depth == 0 {
return slice
}
returnSlice := []interface{}{}
for _, element := range slice {
if s, ok := element.([]interface{}); ok {
returnSlice = append(returnSlice, DeepFlatten(s, depth-1)...)
} else {
returnSlice = append(returnSlic... | [
"func",
"DeepFlatten",
"(",
"slice",
"[",
"]",
"interface",
"{",
"}",
",",
"depth",
"int",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"if",
"depth",
"==",
"0",
"{",
"return",
"slice",
"\n",
"}",
"\n",
"returnSlice",
":=",
"[",
"]",
"interface",
"{"... | // Recursively flattens a list by splicing any sub-lists into their parent until
// depth is reached. If a negative number is passed for depth then it continues
// until no elements of the returned list are lists | [
"Recursively",
"flattens",
"a",
"list",
"by",
"splicing",
"any",
"sub",
"-",
"lists",
"into",
"their",
"parent",
"until",
"depth",
"is",
"reached",
".",
"If",
"a",
"negative",
"number",
"is",
"passed",
"for",
"depth",
"then",
"it",
"continues",
"until",
"n... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/util/slice/slice.go#L90-L106 | train |
hyperledger/burrow | execution/transactor.go | BroadcastTxAsync | func (trans *Transactor) BroadcastTxAsync(ctx context.Context, txEnv *txs.Envelope) (*txs.Receipt, error) {
return trans.CheckTxSync(ctx, txEnv)
} | go | func (trans *Transactor) BroadcastTxAsync(ctx context.Context, txEnv *txs.Envelope) (*txs.Receipt, error) {
return trans.CheckTxSync(ctx, txEnv)
} | [
"func",
"(",
"trans",
"*",
"Transactor",
")",
"BroadcastTxAsync",
"(",
"ctx",
"context",
".",
"Context",
",",
"txEnv",
"*",
"txs",
".",
"Envelope",
")",
"(",
"*",
"txs",
".",
"Receipt",
",",
"error",
")",
"{",
"return",
"trans",
".",
"CheckTxSync",
"("... | // Broadcast a transaction without waiting for confirmation - will attempt to sign server-side and set sequence numbers
// if no signatures are provided | [
"Broadcast",
"a",
"transaction",
"without",
"waiting",
"for",
"confirmation",
"-",
"will",
"attempt",
"to",
"sign",
"server",
"-",
"side",
"and",
"set",
"sequence",
"numbers",
"if",
"no",
"signatures",
"are",
"provided"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/transactor.go#L117-L119 | train |
hyperledger/burrow | execution/exec/stream_event.go | Consume | func (ba *BlockAccumulator) Consume(ev *StreamEvent) *BlockExecution {
switch {
case ev.BeginBlock != nil:
ba.block = &BlockExecution{
Height: ev.BeginBlock.Height,
Header: ev.BeginBlock.Header,
}
case ev.BeginTx != nil, ev.Envelope != nil, ev.Event != nil, ev.EndTx != nil:
txe := ba.stack.Consume(ev)
... | go | func (ba *BlockAccumulator) Consume(ev *StreamEvent) *BlockExecution {
switch {
case ev.BeginBlock != nil:
ba.block = &BlockExecution{
Height: ev.BeginBlock.Height,
Header: ev.BeginBlock.Header,
}
case ev.BeginTx != nil, ev.Envelope != nil, ev.Event != nil, ev.EndTx != nil:
txe := ba.stack.Consume(ev)
... | [
"func",
"(",
"ba",
"*",
"BlockAccumulator",
")",
"Consume",
"(",
"ev",
"*",
"StreamEvent",
")",
"*",
"BlockExecution",
"{",
"switch",
"{",
"case",
"ev",
".",
"BeginBlock",
"!=",
"nil",
":",
"ba",
".",
"block",
"=",
"&",
"BlockExecution",
"{",
"Height",
... | // Consume will add the StreamEvent passed to the block accumulator and if the block complete is complete return the
// BlockExecution, otherwise will return nil | [
"Consume",
"will",
"add",
"the",
"StreamEvent",
"passed",
"to",
"the",
"block",
"accumulator",
"and",
"if",
"the",
"block",
"complete",
"is",
"complete",
"return",
"the",
"BlockExecution",
"otherwise",
"will",
"return",
"nil"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/exec/stream_event.go#L43-L59 | train |
hyperledger/burrow | execution/exec/stream_event.go | Consume | func (stack *TxStack) Consume(ev *StreamEvent) *TxExecution {
switch {
case ev.BeginTx != nil:
stack.Push(initTx(ev.BeginTx))
case ev.Envelope != nil:
txe := stack.Peek()
txe.Envelope = ev.Envelope
txe.Receipt = txe.Envelope.Tx.GenerateReceipt()
case ev.Event != nil:
txe := stack.Peek()
txe.Events = app... | go | func (stack *TxStack) Consume(ev *StreamEvent) *TxExecution {
switch {
case ev.BeginTx != nil:
stack.Push(initTx(ev.BeginTx))
case ev.Envelope != nil:
txe := stack.Peek()
txe.Envelope = ev.Envelope
txe.Receipt = txe.Envelope.Tx.GenerateReceipt()
case ev.Event != nil:
txe := stack.Peek()
txe.Events = app... | [
"func",
"(",
"stack",
"*",
"TxStack",
")",
"Consume",
"(",
"ev",
"*",
"StreamEvent",
")",
"*",
"TxExecution",
"{",
"switch",
"{",
"case",
"ev",
".",
"BeginTx",
"!=",
"nil",
":",
"stack",
".",
"Push",
"(",
"initTx",
"(",
"ev",
".",
"BeginTx",
")",
"... | // Consume will add the StreamEvent to the transaction stack and if that completes a single outermost transaction
// returns the TxExecution otherwise will return nil | [
"Consume",
"will",
"add",
"the",
"StreamEvent",
"to",
"the",
"transaction",
"stack",
"and",
"if",
"that",
"completes",
"a",
"single",
"outermost",
"transaction",
"returns",
"the",
"TxExecution",
"otherwise",
"will",
"return",
"nil"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/exec/stream_event.go#L82-L104 | train |
hyperledger/burrow | acm/validator/validators.go | Diff | func Diff(before, after IterableReader) (*Set, error) {
diff := NewSet()
err := after.IterateValidators(func(id crypto.Addressable, powerAfter *big.Int) error {
powerBefore, err := before.Power(id.GetAddress())
if err != nil {
return err
}
// Exclude any powers from before that much after
if powerBefore.... | go | func Diff(before, after IterableReader) (*Set, error) {
diff := NewSet()
err := after.IterateValidators(func(id crypto.Addressable, powerAfter *big.Int) error {
powerBefore, err := before.Power(id.GetAddress())
if err != nil {
return err
}
// Exclude any powers from before that much after
if powerBefore.... | [
"func",
"Diff",
"(",
"before",
",",
"after",
"IterableReader",
")",
"(",
"*",
"Set",
",",
"error",
")",
"{",
"diff",
":=",
"NewSet",
"(",
")",
"\n",
"err",
":=",
"after",
".",
"IterateValidators",
"(",
"func",
"(",
"id",
"crypto",
".",
"Addressable",
... | // Returns the asymmetric difference, diff, between two Sets such that applying diff to before results in after | [
"Returns",
"the",
"asymmetric",
"difference",
"diff",
"between",
"two",
"Sets",
"such",
"that",
"applying",
"diff",
"to",
"before",
"results",
"in",
"after"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/validators.go#L65-L97 | train |
hyperledger/burrow | acm/validator/validators.go | Add | func Add(vs ReaderWriter, vsOther Iterable) error {
return vsOther.IterateValidators(func(id crypto.Addressable, power *big.Int) error {
return AddPower(vs, id.GetPublicKey(), power)
})
} | go | func Add(vs ReaderWriter, vsOther Iterable) error {
return vsOther.IterateValidators(func(id crypto.Addressable, power *big.Int) error {
return AddPower(vs, id.GetPublicKey(), power)
})
} | [
"func",
"Add",
"(",
"vs",
"ReaderWriter",
",",
"vsOther",
"Iterable",
")",
"error",
"{",
"return",
"vsOther",
".",
"IterateValidators",
"(",
"func",
"(",
"id",
"crypto",
".",
"Addressable",
",",
"power",
"*",
"big",
".",
"Int",
")",
"error",
"{",
"return... | // Adds vsOther to vs | [
"Adds",
"vsOther",
"to",
"vs"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/validators.go#L113-L117 | train |
hyperledger/burrow | acm/validator/validators.go | Subtract | func Subtract(vs ReaderWriter, vsOther Iterable) error {
return vsOther.IterateValidators(func(id crypto.Addressable, power *big.Int) error {
return SubtractPower(vs, id.GetPublicKey(), power)
})
} | go | func Subtract(vs ReaderWriter, vsOther Iterable) error {
return vsOther.IterateValidators(func(id crypto.Addressable, power *big.Int) error {
return SubtractPower(vs, id.GetPublicKey(), power)
})
} | [
"func",
"Subtract",
"(",
"vs",
"ReaderWriter",
",",
"vsOther",
"Iterable",
")",
"error",
"{",
"return",
"vsOther",
".",
"IterateValidators",
"(",
"func",
"(",
"id",
"crypto",
".",
"Addressable",
",",
"power",
"*",
"big",
".",
"Int",
")",
"error",
"{",
"r... | // Subtracts vsOther from vs | [
"Subtracts",
"vsOther",
"from",
"vs"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/validator/validators.go#L120-L124 | train |
hyperledger/burrow | event/query/reflect_tagged.go | ReflectTags | func ReflectTags(value interface{}, fieldNames ...string) (*ReflectTagged, error) {
rv := reflect.ValueOf(value)
if rv.IsNil() {
return &ReflectTagged{}, nil
}
if rv.Kind() != reflect.Ptr {
return nil, fmt.Errorf("ReflectStructTags needs a pointer to a struct but %v is not a pointer",
rv.Interface())
}
if ... | go | func ReflectTags(value interface{}, fieldNames ...string) (*ReflectTagged, error) {
rv := reflect.ValueOf(value)
if rv.IsNil() {
return &ReflectTagged{}, nil
}
if rv.Kind() != reflect.Ptr {
return nil, fmt.Errorf("ReflectStructTags needs a pointer to a struct but %v is not a pointer",
rv.Interface())
}
if ... | [
"func",
"ReflectTags",
"(",
"value",
"interface",
"{",
"}",
",",
"fieldNames",
"...",
"string",
")",
"(",
"*",
"ReflectTagged",
",",
"error",
")",
"{",
"rv",
":=",
"reflect",
".",
"ValueOf",
"(",
"value",
")",
"\n",
"if",
"rv",
".",
"IsNil",
"(",
")"... | // ReflectTags provides a query.Tagged on a structs exported fields using query.StringFromValue to derive the string
// values associated with each field. If passed explicit field names will only only provide those fields as tags,
// otherwise all exported fields are provided. | [
"ReflectTags",
"provides",
"a",
"query",
".",
"Tagged",
"on",
"a",
"structs",
"exported",
"fields",
"using",
"query",
".",
"StringFromValue",
"to",
"derive",
"the",
"string",
"values",
"associated",
"with",
"each",
"field",
".",
"If",
"passed",
"explicit",
"fi... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/query/reflect_tagged.go#L29-L83 | train |
hyperledger/burrow | acm/acmstate/memory_state.go | NewMemoryState | func NewMemoryState() *MemoryState {
return &MemoryState{
Accounts: make(map[crypto.Address]*acm.Account),
Storage: make(map[crypto.Address]map[binary.Word256]binary.Word256),
}
} | go | func NewMemoryState() *MemoryState {
return &MemoryState{
Accounts: make(map[crypto.Address]*acm.Account),
Storage: make(map[crypto.Address]map[binary.Word256]binary.Word256),
}
} | [
"func",
"NewMemoryState",
"(",
")",
"*",
"MemoryState",
"{",
"return",
"&",
"MemoryState",
"{",
"Accounts",
":",
"make",
"(",
"map",
"[",
"crypto",
".",
"Address",
"]",
"*",
"acm",
".",
"Account",
")",
",",
"Storage",
":",
"make",
"(",
"map",
"[",
"c... | // Get an in-memory state IterableReader | [
"Get",
"an",
"in",
"-",
"memory",
"state",
"IterableReader"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/acm/acmstate/memory_state.go#L19-L24 | train |
hyperledger/burrow | logging/structure/structure.go | ValuesAndContext | func ValuesAndContext(keyvals []interface{},
keys ...interface{}) (map[string]interface{}, []interface{}) {
vals := make(map[string]interface{}, len(keys))
context := make([]interface{}, len(keyvals))
copy(context, keyvals)
deletions := 0
// We can't really do better than a linear scan of both lists here. N is s... | go | func ValuesAndContext(keyvals []interface{},
keys ...interface{}) (map[string]interface{}, []interface{}) {
vals := make(map[string]interface{}, len(keys))
context := make([]interface{}, len(keyvals))
copy(context, keyvals)
deletions := 0
// We can't really do better than a linear scan of both lists here. N is s... | [
"func",
"ValuesAndContext",
"(",
"keyvals",
"[",
"]",
"interface",
"{",
"}",
",",
"keys",
"...",
"interface",
"{",
"}",
")",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"vals",
":=",
"make"... | // Pull the specified values from a structured log line into a map.
// Assumes keys are single-valued.
// Returns a map of the key-values from the requested keys and
// the unmatched remainder keyvals as context as a slice of key-values. | [
"Pull",
"the",
"specified",
"values",
"from",
"a",
"structured",
"log",
"line",
"into",
"a",
"map",
".",
"Assumes",
"keys",
"are",
"single",
"-",
"valued",
".",
"Returns",
"a",
"map",
"of",
"the",
"key",
"-",
"values",
"from",
"the",
"requested",
"keys",... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/structure/structure.go#L65-L92 | train |
hyperledger/burrow | logging/structure/structure.go | KeyValuesMap | func KeyValuesMap(keyvals []interface{}) map[string]interface{} {
length := len(keyvals) / 2
vals := make(map[string]interface{}, length)
for i := 0; i < 2*length; i += 2 {
vals[StringifyKey(keyvals[i])] = keyvals[i+1]
}
return vals
} | go | func KeyValuesMap(keyvals []interface{}) map[string]interface{} {
length := len(keyvals) / 2
vals := make(map[string]interface{}, length)
for i := 0; i < 2*length; i += 2 {
vals[StringifyKey(keyvals[i])] = keyvals[i+1]
}
return vals
} | [
"func",
"KeyValuesMap",
"(",
"keyvals",
"[",
"]",
"interface",
"{",
"}",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"length",
":=",
"len",
"(",
"keyvals",
")",
"/",
"2",
"\n",
"vals",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
... | // Returns keyvals as a map from keys to vals | [
"Returns",
"keyvals",
"as",
"a",
"map",
"from",
"keys",
"to",
"vals"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/structure/structure.go#L95-L102 | train |
hyperledger/burrow | logging/structure/structure.go | DropKeys | func DropKeys(keyvals []interface{}, dropKeyValPredicate func(key, value interface{}) bool) []interface{} {
keyvalsDropped := make([]interface{}, 0, len(keyvals))
for i := 0; i < 2*(len(keyvals)/2); i += 2 {
if !dropKeyValPredicate(keyvals[i], keyvals[i+1]) {
keyvalsDropped = append(keyvalsDropped, keyvals[i], k... | go | func DropKeys(keyvals []interface{}, dropKeyValPredicate func(key, value interface{}) bool) []interface{} {
keyvalsDropped := make([]interface{}, 0, len(keyvals))
for i := 0; i < 2*(len(keyvals)/2); i += 2 {
if !dropKeyValPredicate(keyvals[i], keyvals[i+1]) {
keyvalsDropped = append(keyvalsDropped, keyvals[i], k... | [
"func",
"DropKeys",
"(",
"keyvals",
"[",
"]",
"interface",
"{",
"}",
",",
"dropKeyValPredicate",
"func",
"(",
"key",
",",
"value",
"interface",
"{",
"}",
")",
"bool",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"keyvalsDropped",
":=",
"make",
"(",
"[",
... | // Drops all key value pairs where dropKeyValPredicate is true | [
"Drops",
"all",
"key",
"value",
"pairs",
"where",
"dropKeyValPredicate",
"is",
"true"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/structure/structure.go#L127-L135 | train |
hyperledger/burrow | logging/structure/structure.go | Vectorise | func Vectorise(keyvals []interface{}, vectorKeys ...string) []interface{} {
// We rely on working against a single backing array, so we use a capacity that is the maximum possible size of the
// slice after vectorising (in the case there are no duplicate keys and this is a no-op)
outputKeyvals := make([]interface{},... | go | func Vectorise(keyvals []interface{}, vectorKeys ...string) []interface{} {
// We rely on working against a single backing array, so we use a capacity that is the maximum possible size of the
// slice after vectorising (in the case there are no duplicate keys and this is a no-op)
outputKeyvals := make([]interface{},... | [
"func",
"Vectorise",
"(",
"keyvals",
"[",
"]",
"interface",
"{",
"}",
",",
"vectorKeys",
"...",
"string",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"// We rely on working against a single backing array, so we use a capacity that is the maximum possible size of the",
"// sl... | // 'Vectorises' values associated with repeated string keys member by collapsing many values into a single vector value.
// The result is a copy of keyvals where the first occurrence of each matching key and its first value are replaced by
// that key and all of its values in a single slice. | [
"Vectorises",
"values",
"associated",
"with",
"repeated",
"string",
"keys",
"member",
"by",
"collapsing",
"many",
"values",
"into",
"a",
"single",
"vector",
"value",
".",
"The",
"result",
"is",
"a",
"copy",
"of",
"keyvals",
"where",
"the",
"first",
"occurrence... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/structure/structure.go#L167-L206 | train |
hyperledger/burrow | logging/structure/structure.go | Value | func Value(keyvals []interface{}, key interface{}) interface{} {
for i := 0; i < 2*(len(keyvals)/2); i += 2 {
if keyvals[i] == key {
return keyvals[i+1]
}
}
return nil
} | go | func Value(keyvals []interface{}, key interface{}) interface{} {
for i := 0; i < 2*(len(keyvals)/2); i += 2 {
if keyvals[i] == key {
return keyvals[i+1]
}
}
return nil
} | [
"func",
"Value",
"(",
"keyvals",
"[",
"]",
"interface",
"{",
"}",
",",
"key",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"2",
"*",
"(",
"len",
"(",
"keyvals",
")",
"/",
"2",
")",
";",
"i",
... | // Return a single value corresponding to key in keyvals | [
"Return",
"a",
"single",
"value",
"corresponding",
"to",
"key",
"in",
"keyvals"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/structure/structure.go#L209-L216 | train |
hyperledger/burrow | logging/structure/structure.go | StringifyKey | func StringifyKey(key interface{}) string {
switch key {
// For named keys we want to handle explicitly
default:
// Stringify keys
switch k := key.(type) {
case string:
return k
case fmt.Stringer:
return k.String()
default:
return fmt.Sprintf("%v", key)
}
}
} | go | func StringifyKey(key interface{}) string {
switch key {
// For named keys we want to handle explicitly
default:
// Stringify keys
switch k := key.(type) {
case string:
return k
case fmt.Stringer:
return k.String()
default:
return fmt.Sprintf("%v", key)
}
}
} | [
"func",
"StringifyKey",
"(",
"key",
"interface",
"{",
"}",
")",
"string",
"{",
"switch",
"key",
"{",
"// For named keys we want to handle explicitly",
"default",
":",
"// Stringify keys",
"switch",
"k",
":=",
"key",
".",
"(",
"type",
")",
"{",
"case",
"string",
... | // Provides a canonical way to stringify keys | [
"Provides",
"a",
"canonical",
"way",
"to",
"stringify",
"keys"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/structure/structure.go#L254-L269 | train |
hyperledger/burrow | logging/structure/structure.go | Signal | func Signal(keyvals []interface{}) string {
last := len(keyvals) - 1
if last > 0 && keyvals[last-1] == SignalKey {
signal, ok := keyvals[last].(string)
if ok {
return signal
}
}
return ""
} | go | func Signal(keyvals []interface{}) string {
last := len(keyvals) - 1
if last > 0 && keyvals[last-1] == SignalKey {
signal, ok := keyvals[last].(string)
if ok {
return signal
}
}
return ""
} | [
"func",
"Signal",
"(",
"keyvals",
"[",
"]",
"interface",
"{",
"}",
")",
"string",
"{",
"last",
":=",
"len",
"(",
"keyvals",
")",
"-",
"1",
"\n",
"if",
"last",
">",
"0",
"&&",
"keyvals",
"[",
"last",
"-",
"1",
"]",
"==",
"SignalKey",
"{",
"signal"... | // Tried to interpret the logline as a signal by matching the last key-value pair as a signal,
// returns empty string if no match. The idea with signals is that the should be transmitted to a root logger
// as a single key-value pair so we avoid the need to do a linear probe over every log line in order to detect a si... | [
"Tried",
"to",
"interpret",
"the",
"logline",
"as",
"a",
"signal",
"by",
"matching",
"the",
"last",
"key",
"-",
"value",
"pair",
"as",
"a",
"signal",
"returns",
"empty",
"string",
"if",
"no",
"match",
".",
"The",
"idea",
"with",
"signals",
"is",
"that",
... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/structure/structure.go#L284-L293 | train |
hyperledger/burrow | execution/exec/block_execution.go | StreamEvents | func (be *BlockExecution) StreamEvents() StreamEvents {
var ses StreamEvents
ses = append(ses, &StreamEvent{
BeginBlock: &BeginBlock{
Height: be.Height,
Header: be.Header,
},
})
for _, txe := range be.TxExecutions {
ses = append(ses, txe.StreamEvents()...)
}
return append(ses, &StreamEvent{
EndBlock... | go | func (be *BlockExecution) StreamEvents() StreamEvents {
var ses StreamEvents
ses = append(ses, &StreamEvent{
BeginBlock: &BeginBlock{
Height: be.Height,
Header: be.Header,
},
})
for _, txe := range be.TxExecutions {
ses = append(ses, txe.StreamEvents()...)
}
return append(ses, &StreamEvent{
EndBlock... | [
"func",
"(",
"be",
"*",
"BlockExecution",
")",
"StreamEvents",
"(",
")",
"StreamEvents",
"{",
"var",
"ses",
"StreamEvents",
"\n",
"ses",
"=",
"append",
"(",
"ses",
",",
"&",
"StreamEvent",
"{",
"BeginBlock",
":",
"&",
"BeginBlock",
"{",
"Height",
":",
"b... | // Write out TxExecutions parenthetically | [
"Write",
"out",
"TxExecutions",
"parenthetically"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/exec/block_execution.go#L23-L39 | train |
hyperledger/burrow | storage/kvcache.go | WriteTo | func (kvc *KVCache) WriteTo(writer KVWriter) {
kvc.Lock()
defer kvc.Unlock()
for k, vi := range kvc.cache {
kb := []byte(k)
if vi.deleted {
writer.Delete(kb)
} else {
writer.Set(kb, vi.value)
}
}
} | go | func (kvc *KVCache) WriteTo(writer KVWriter) {
kvc.Lock()
defer kvc.Unlock()
for k, vi := range kvc.cache {
kb := []byte(k)
if vi.deleted {
writer.Delete(kb)
} else {
writer.Set(kb, vi.value)
}
}
} | [
"func",
"(",
"kvc",
"*",
"KVCache",
")",
"WriteTo",
"(",
"writer",
"KVWriter",
")",
"{",
"kvc",
".",
"Lock",
"(",
")",
"\n",
"defer",
"kvc",
".",
"Unlock",
"(",
")",
"\n",
"for",
"k",
",",
"vi",
":=",
"range",
"kvc",
".",
"cache",
"{",
"kb",
":... | // Writes contents of cache to backend without flushing the cache | [
"Writes",
"contents",
"of",
"cache",
"to",
"backend",
"without",
"flushing",
"the",
"cache"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/kvcache.go#L109-L120 | train |
hyperledger/burrow | event/emitter.go | NewEmitter | func NewEmitter() *Emitter {
pubsubServer := pubsub.NewServer(pubsub.BufferCapacity(DefaultEventBufferCapacity))
pubsubServer.BaseService = *common.NewBaseService(nil, "Emitter", pubsubServer)
pubsubServer.Start()
return &Emitter{
pubsubServer: pubsubServer,
}
} | go | func NewEmitter() *Emitter {
pubsubServer := pubsub.NewServer(pubsub.BufferCapacity(DefaultEventBufferCapacity))
pubsubServer.BaseService = *common.NewBaseService(nil, "Emitter", pubsubServer)
pubsubServer.Start()
return &Emitter{
pubsubServer: pubsubServer,
}
} | [
"func",
"NewEmitter",
"(",
")",
"*",
"Emitter",
"{",
"pubsubServer",
":=",
"pubsub",
".",
"NewServer",
"(",
"pubsub",
".",
"BufferCapacity",
"(",
"DefaultEventBufferCapacity",
")",
")",
"\n",
"pubsubServer",
".",
"BaseService",
"=",
"*",
"common",
".",
"NewBas... | // NewEmitter initializes an emitter struct with a pubsubServer | [
"NewEmitter",
"initializes",
"an",
"emitter",
"struct",
"with",
"a",
"pubsubServer"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/emitter.go#L42-L49 | train |
hyperledger/burrow | event/emitter.go | SetLogger | func (em *Emitter) SetLogger(logger *logging.Logger) {
em.logger = logger.With(structure.ComponentKey, "Events")
} | go | func (em *Emitter) SetLogger(logger *logging.Logger) {
em.logger = logger.With(structure.ComponentKey, "Events")
} | [
"func",
"(",
"em",
"*",
"Emitter",
")",
"SetLogger",
"(",
"logger",
"*",
"logging",
".",
"Logger",
")",
"{",
"em",
".",
"logger",
"=",
"logger",
".",
"With",
"(",
"structure",
".",
"ComponentKey",
",",
"\"",
"\"",
")",
"\n",
"}"
] | // SetLogger attaches a log handler to this emitter | [
"SetLogger",
"attaches",
"a",
"log",
"handler",
"to",
"this",
"emitter"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/emitter.go#L52-L54 | train |
hyperledger/burrow | event/emitter.go | Shutdown | func (em *Emitter) Shutdown(ctx context.Context) error {
return em.pubsubServer.Stop()
} | go | func (em *Emitter) Shutdown(ctx context.Context) error {
return em.pubsubServer.Stop()
} | [
"func",
"(",
"em",
"*",
"Emitter",
")",
"Shutdown",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"return",
"em",
".",
"pubsubServer",
".",
"Stop",
"(",
")",
"\n",
"}"
] | // Shutdown stops the pubsubServer | [
"Shutdown",
"stops",
"the",
"pubsubServer"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/emitter.go#L57-L59 | train |
hyperledger/burrow | event/emitter.go | Publish | func (em *Emitter) Publish(ctx context.Context, message interface{}, tags query.Tagged) error {
if em == nil || em.pubsubServer == nil {
return nil
}
return em.pubsubServer.PublishWithTags(ctx, message, tags)
} | go | func (em *Emitter) Publish(ctx context.Context, message interface{}, tags query.Tagged) error {
if em == nil || em.pubsubServer == nil {
return nil
}
return em.pubsubServer.PublishWithTags(ctx, message, tags)
} | [
"func",
"(",
"em",
"*",
"Emitter",
")",
"Publish",
"(",
"ctx",
"context",
".",
"Context",
",",
"message",
"interface",
"{",
"}",
",",
"tags",
"query",
".",
"Tagged",
")",
"error",
"{",
"if",
"em",
"==",
"nil",
"||",
"em",
".",
"pubsubServer",
"==",
... | // Publish tells the emitter to publish with the given message and tags | [
"Publish",
"tells",
"the",
"emitter",
"to",
"publish",
"with",
"the",
"given",
"message",
"and",
"tags"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/emitter.go#L62-L67 | train |
hyperledger/burrow | event/emitter.go | Subscribe | func (em *Emitter) Subscribe(ctx context.Context, subscriber string, queryable query.Queryable, bufferSize int) (<-chan interface{}, error) {
qry, err := queryable.Query()
if err != nil {
return nil, err
}
return em.pubsubServer.Subscribe(ctx, subscriber, qry, bufferSize)
} | go | func (em *Emitter) Subscribe(ctx context.Context, subscriber string, queryable query.Queryable, bufferSize int) (<-chan interface{}, error) {
qry, err := queryable.Query()
if err != nil {
return nil, err
}
return em.pubsubServer.Subscribe(ctx, subscriber, qry, bufferSize)
} | [
"func",
"(",
"em",
"*",
"Emitter",
")",
"Subscribe",
"(",
"ctx",
"context",
".",
"Context",
",",
"subscriber",
"string",
",",
"queryable",
"query",
".",
"Queryable",
",",
"bufferSize",
"int",
")",
"(",
"<-",
"chan",
"interface",
"{",
"}",
",",
"error",
... | // Subscribe tells the emitter to listen for messages on the given query | [
"Subscribe",
"tells",
"the",
"emitter",
"to",
"listen",
"for",
"messages",
"on",
"the",
"given",
"query"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/emitter.go#L70-L76 | train |
hyperledger/burrow | event/emitter.go | Unsubscribe | func (em *Emitter) Unsubscribe(ctx context.Context, subscriber string, queryable query.Queryable) error {
pubsubQuery, err := queryable.Query()
if err != nil {
return nil
}
return em.pubsubServer.Unsubscribe(ctx, subscriber, pubsubQuery)
} | go | func (em *Emitter) Unsubscribe(ctx context.Context, subscriber string, queryable query.Queryable) error {
pubsubQuery, err := queryable.Query()
if err != nil {
return nil
}
return em.pubsubServer.Unsubscribe(ctx, subscriber, pubsubQuery)
} | [
"func",
"(",
"em",
"*",
"Emitter",
")",
"Unsubscribe",
"(",
"ctx",
"context",
".",
"Context",
",",
"subscriber",
"string",
",",
"queryable",
"query",
".",
"Queryable",
")",
"error",
"{",
"pubsubQuery",
",",
"err",
":=",
"queryable",
".",
"Query",
"(",
")... | // Unsubscribe tells the emitter to stop listening for said messages | [
"Unsubscribe",
"tells",
"the",
"emitter",
"to",
"stop",
"listening",
"for",
"said",
"messages"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/emitter.go#L79-L85 | train |
hyperledger/burrow | event/emitter.go | UnsubscribeAll | func (em *Emitter) UnsubscribeAll(ctx context.Context, subscriber string) error {
return em.pubsubServer.UnsubscribeAll(ctx, subscriber)
} | go | func (em *Emitter) UnsubscribeAll(ctx context.Context, subscriber string) error {
return em.pubsubServer.UnsubscribeAll(ctx, subscriber)
} | [
"func",
"(",
"em",
"*",
"Emitter",
")",
"UnsubscribeAll",
"(",
"ctx",
"context",
".",
"Context",
",",
"subscriber",
"string",
")",
"error",
"{",
"return",
"em",
".",
"pubsubServer",
".",
"UnsubscribeAll",
"(",
"ctx",
",",
"subscriber",
")",
"\n",
"}"
] | // UnsubscribeAll just stop listening for all messages | [
"UnsubscribeAll",
"just",
"stop",
"listening",
"for",
"all",
"messages"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/event/emitter.go#L88-L90 | train |
hyperledger/burrow | logging/loggers/capture_logger.go | SetPassthrough | func (cl *CaptureLogger) SetPassthrough(passthrough bool) {
cl.Lock()
defer cl.Unlock()
cl.passthrough = passthrough
} | go | func (cl *CaptureLogger) SetPassthrough(passthrough bool) {
cl.Lock()
defer cl.Unlock()
cl.passthrough = passthrough
} | [
"func",
"(",
"cl",
"*",
"CaptureLogger",
")",
"SetPassthrough",
"(",
"passthrough",
"bool",
")",
"{",
"cl",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cl",
".",
"Unlock",
"(",
")",
"\n",
"cl",
".",
"passthrough",
"=",
"passthrough",
"\n",
"}"
] | // Sets whether the CaptureLogger is forwarding log lines sent to it through
// to its output logger. Concurrently safe. | [
"Sets",
"whether",
"the",
"CaptureLogger",
"is",
"forwarding",
"log",
"lines",
"sent",
"to",
"it",
"through",
"to",
"its",
"output",
"logger",
".",
"Concurrently",
"safe",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/capture_logger.go#L58-L62 | train |
hyperledger/burrow | logging/loggers/capture_logger.go | Passthrough | func (cl *CaptureLogger) Passthrough() bool {
cl.RLock()
defer cl.RUnlock()
return cl.passthrough
} | go | func (cl *CaptureLogger) Passthrough() bool {
cl.RLock()
defer cl.RUnlock()
return cl.passthrough
} | [
"func",
"(",
"cl",
"*",
"CaptureLogger",
")",
"Passthrough",
"(",
")",
"bool",
"{",
"cl",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cl",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"cl",
".",
"passthrough",
"\n",
"}"
] | // Gets whether the CaptureLogger is forwarding log lines sent to through to its
// OutputLogger. Concurrently Safe. | [
"Gets",
"whether",
"the",
"CaptureLogger",
"is",
"forwarding",
"log",
"lines",
"sent",
"to",
"through",
"to",
"its",
"OutputLogger",
".",
"Concurrently",
"Safe",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/loggers/capture_logger.go#L66-L70 | train |
hyperledger/burrow | util/logging/cmd/main.go | main | func main() {
loggingConfig := &LoggingConfig{
RootSink: Sink().
AddSinks(
// Log everything to Stderr
Sink().SetOutput(StderrOutput()),
Sink().SetTransform(FilterTransform(ExcludeWhenAllMatch,
"module", "p2p",
"captured_logging_source", "tendermint_log15")).
AddSinks(
Sink().SetO... | go | func main() {
loggingConfig := &LoggingConfig{
RootSink: Sink().
AddSinks(
// Log everything to Stderr
Sink().SetOutput(StderrOutput()),
Sink().SetTransform(FilterTransform(ExcludeWhenAllMatch,
"module", "p2p",
"captured_logging_source", "tendermint_log15")).
AddSinks(
Sink().SetO... | [
"func",
"main",
"(",
")",
"{",
"loggingConfig",
":=",
"&",
"LoggingConfig",
"{",
"RootSink",
":",
"Sink",
"(",
")",
".",
"AddSinks",
"(",
"// Log everything to Stderr",
"Sink",
"(",
")",
".",
"SetOutput",
"(",
"StderrOutput",
"(",
")",
")",
",",
"Sink",
... | // Dump an example logging configuration | [
"Dump",
"an",
"example",
"logging",
"configuration"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/util/logging/cmd/main.go#L24-L39 | train |
hyperledger/burrow | logging/logger.go | NewLogger | func NewLogger(outputLogger log.Logger) *Logger {
// We will never halt the progress of a log emitter. If log output takes too
// long will start dropping log lines by using a ring buffer.
swapLogger := new(log.SwapLogger)
swapLogger.Swap(outputLogger)
return &Logger{
Output: swapLogger,
// logging contexts
... | go | func NewLogger(outputLogger log.Logger) *Logger {
// We will never halt the progress of a log emitter. If log output takes too
// long will start dropping log lines by using a ring buffer.
swapLogger := new(log.SwapLogger)
swapLogger.Swap(outputLogger)
return &Logger{
Output: swapLogger,
// logging contexts
... | [
"func",
"NewLogger",
"(",
"outputLogger",
"log",
".",
"Logger",
")",
"*",
"Logger",
"{",
"// We will never halt the progress of a log emitter. If log output takes too",
"// long will start dropping log lines by using a ring buffer.",
"swapLogger",
":=",
"new",
"(",
"log",
".",
... | // Create an InfoTraceLogger by passing the initial outputLogger. | [
"Create",
"an",
"InfoTraceLogger",
"by",
"passing",
"the",
"initial",
"outputLogger",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/logger.go#L44-L59 | train |
hyperledger/burrow | logging/logger.go | SwapOutput | func (l *Logger) SwapOutput(infoLogger log.Logger) {
l.Output.Swap(infoLogger)
} | go | func (l *Logger) SwapOutput(infoLogger log.Logger) {
l.Output.Swap(infoLogger)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"SwapOutput",
"(",
"infoLogger",
"log",
".",
"Logger",
")",
"{",
"l",
".",
"Output",
".",
"Swap",
"(",
"infoLogger",
")",
"\n",
"}"
] | // Hot swap the underlying outputLogger with another one to re-route messages | [
"Hot",
"swap",
"the",
"underlying",
"outputLogger",
"with",
"another",
"one",
"to",
"re",
"-",
"route",
"messages"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/logger.go#L127-L129 | train |
hyperledger/burrow | logging/logger.go | InfoMsg | func (l *Logger) InfoMsg(message string, keyvals ...interface{}) error {
return Msg(l.Info, message, keyvals...)
} | go | func (l *Logger) InfoMsg(message string, keyvals ...interface{}) error {
return Msg(l.Info, message, keyvals...)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"InfoMsg",
"(",
"message",
"string",
",",
"keyvals",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"Msg",
"(",
"l",
".",
"Info",
",",
"message",
",",
"keyvals",
"...",
")",
"\n",
"}"
] | // Record structured Info lo`g line with a message | [
"Record",
"structured",
"Info",
"lo",
"g",
"line",
"with",
"a",
"message"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/logger.go#L132-L134 | train |
hyperledger/burrow | logging/logger.go | TraceMsg | func (l *Logger) TraceMsg(message string, keyvals ...interface{}) error {
return Msg(l.Trace, message, keyvals...)
} | go | func (l *Logger) TraceMsg(message string, keyvals ...interface{}) error {
return Msg(l.Trace, message, keyvals...)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"TraceMsg",
"(",
"message",
"string",
",",
"keyvals",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"Msg",
"(",
"l",
".",
"Trace",
",",
"message",
",",
"keyvals",
"...",
")",
"\n",
"}"
] | // Record structured Trace log line with a message | [
"Record",
"structured",
"Trace",
"log",
"line",
"with",
"a",
"message"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/logger.go#L137-L139 | train |
hyperledger/burrow | logging/logger.go | WithScope | func (l *Logger) WithScope(scopeName string) *Logger {
// InfoTraceLogger will collapse successive (ScopeKey, scopeName) pairs into a vector in the order which they appear
return l.With(structure.ScopeKey, scopeName)
} | go | func (l *Logger) WithScope(scopeName string) *Logger {
// InfoTraceLogger will collapse successive (ScopeKey, scopeName) pairs into a vector in the order which they appear
return l.With(structure.ScopeKey, scopeName)
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"WithScope",
"(",
"scopeName",
"string",
")",
"*",
"Logger",
"{",
"// InfoTraceLogger will collapse successive (ScopeKey, scopeName) pairs into a vector in the order which they appear",
"return",
"l",
".",
"With",
"(",
"structure",
".",... | // Establish or extend the scope of this logger by appending scopeName to the Scope vector.
// Like With the logging scope is append only but can be used to provide parenthetical scopes by hanging on to the
// parent scope and using once the scope has been exited. The scope mechanism does is agnostic to the type of sco... | [
"Establish",
"or",
"extend",
"the",
"scope",
"of",
"this",
"logger",
"by",
"appending",
"scopeName",
"to",
"the",
"Scope",
"vector",
".",
"Like",
"With",
"the",
"logging",
"scope",
"is",
"append",
"only",
"but",
"can",
"be",
"used",
"to",
"provide",
"paren... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/logger.go#L145-L148 | train |
hyperledger/burrow | logging/logger.go | Msg | func Msg(logger log.Logger, message string, keyvals ...interface{}) error {
prepended := structure.CopyPrepend(keyvals, structure.MessageKey, message)
return logger.Log(prepended...)
} | go | func Msg(logger log.Logger, message string, keyvals ...interface{}) error {
prepended := structure.CopyPrepend(keyvals, structure.MessageKey, message)
return logger.Log(prepended...)
} | [
"func",
"Msg",
"(",
"logger",
"log",
".",
"Logger",
",",
"message",
"string",
",",
"keyvals",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"prepended",
":=",
"structure",
".",
"CopyPrepend",
"(",
"keyvals",
",",
"structure",
".",
"MessageKey",
",",
"... | // Record a structured log line with a message | [
"Record",
"a",
"structured",
"log",
"line",
"with",
"a",
"message"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/logger.go#L151-L154 | train |
hyperledger/burrow | crypto/sha3/sha3.go | unalignedAbsorb | func (d *digest) unalignedAbsorb(p []byte) {
var t uint64
for i := len(p) - 1; i >= 0; i-- {
t <<= 8
t |= uint64(p[i])
}
offset := (d.absorbed) % d.rate()
t <<= 8 * uint(offset%laneSize)
d.a[offset/laneSize] ^= t
d.absorbed += len(p)
} | go | func (d *digest) unalignedAbsorb(p []byte) {
var t uint64
for i := len(p) - 1; i >= 0; i-- {
t <<= 8
t |= uint64(p[i])
}
offset := (d.absorbed) % d.rate()
t <<= 8 * uint(offset%laneSize)
d.a[offset/laneSize] ^= t
d.absorbed += len(p)
} | [
"func",
"(",
"d",
"*",
"digest",
")",
"unalignedAbsorb",
"(",
"p",
"[",
"]",
"byte",
")",
"{",
"var",
"t",
"uint64",
"\n",
"for",
"i",
":=",
"len",
"(",
"p",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"t",
"<<=",
"8",
"\n",
... | // unalignedAbsorb is a helper function for Write, which absorbs data that isn't aligned with an
// 8-byte lane. This requires shifting the individual bytes into position in a uint64. | [
"unalignedAbsorb",
"is",
"a",
"helper",
"function",
"for",
"Write",
"which",
"absorbs",
"data",
"that",
"isn",
"t",
"aligned",
"with",
"an",
"8",
"-",
"byte",
"lane",
".",
"This",
"requires",
"shifting",
"the",
"individual",
"bytes",
"into",
"position",
"in"... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/crypto/sha3/sha3.go#L89-L99 | train |
hyperledger/burrow | crypto/sha3/sha3.go | Sum | func (d *digest) Sum(in []byte) []byte {
// Make a copy of the original hash so that caller can keep writing and summing.
dup := *d
dup.finalize()
return dup.squeeze(in, dup.outputSize)
} | go | func (d *digest) Sum(in []byte) []byte {
// Make a copy of the original hash so that caller can keep writing and summing.
dup := *d
dup.finalize()
return dup.squeeze(in, dup.outputSize)
} | [
"func",
"(",
"d",
"*",
"digest",
")",
"Sum",
"(",
"in",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"// Make a copy of the original hash so that caller can keep writing and summing.",
"dup",
":=",
"*",
"d",
"\n",
"dup",
".",
"finalize",
"(",
")",
"\n",
"re... | // Sum applies padding to the hash state and then squeezes out the desired nubmer of output bytes. | [
"Sum",
"applies",
"padding",
"to",
"the",
"hash",
"state",
"and",
"then",
"squeezes",
"out",
"the",
"desired",
"nubmer",
"of",
"output",
"bytes",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/crypto/sha3/sha3.go#L203-L208 | train |
hyperledger/burrow | logging/lifecycle/lifecycle.go | NewLoggerFromLoggingConfig | func NewLoggerFromLoggingConfig(loggingConfig *logconfig.LoggingConfig) (*logging.Logger, error) {
if loggingConfig == nil {
return NewStdErrLogger()
} else {
outputLogger, errCh, err := loggerFromLoggingConfig(loggingConfig)
if err != nil {
return nil, err
}
logger := logging.NewLogger(outputLogger)
i... | go | func NewLoggerFromLoggingConfig(loggingConfig *logconfig.LoggingConfig) (*logging.Logger, error) {
if loggingConfig == nil {
return NewStdErrLogger()
} else {
outputLogger, errCh, err := loggerFromLoggingConfig(loggingConfig)
if err != nil {
return nil, err
}
logger := logging.NewLogger(outputLogger)
i... | [
"func",
"NewLoggerFromLoggingConfig",
"(",
"loggingConfig",
"*",
"logconfig",
".",
"LoggingConfig",
")",
"(",
"*",
"logging",
".",
"Logger",
",",
"error",
")",
"{",
"if",
"loggingConfig",
"==",
"nil",
"{",
"return",
"NewStdErrLogger",
"(",
")",
"\n",
"}",
"e... | // Lifecycle provides a canonical source for burrow loggers. Components should use the functions here
// to set up their root logger and capture any other logging output.
// Obtain a logger from a LoggingConfig | [
"Lifecycle",
"provides",
"a",
"canonical",
"source",
"for",
"burrow",
"loggers",
".",
"Components",
"should",
"use",
"the",
"functions",
"here",
"to",
"set",
"up",
"their",
"root",
"logger",
"and",
"capture",
"any",
"other",
"logging",
"output",
".",
"Obtain",... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/lifecycle/lifecycle.go#L37-L57 | train |
hyperledger/burrow | logging/lifecycle/lifecycle.go | SwapOutputLoggersFromLoggingConfig | func SwapOutputLoggersFromLoggingConfig(logger *logging.Logger, loggingConfig *logconfig.LoggingConfig) (error, channels.Channel) {
outputLogger, errCh, err := loggerFromLoggingConfig(loggingConfig)
if err != nil {
return err, channels.NewDeadChannel()
}
logger.SwapOutput(outputLogger)
return nil, errCh
} | go | func SwapOutputLoggersFromLoggingConfig(logger *logging.Logger, loggingConfig *logconfig.LoggingConfig) (error, channels.Channel) {
outputLogger, errCh, err := loggerFromLoggingConfig(loggingConfig)
if err != nil {
return err, channels.NewDeadChannel()
}
logger.SwapOutput(outputLogger)
return nil, errCh
} | [
"func",
"SwapOutputLoggersFromLoggingConfig",
"(",
"logger",
"*",
"logging",
".",
"Logger",
",",
"loggingConfig",
"*",
"logconfig",
".",
"LoggingConfig",
")",
"(",
"error",
",",
"channels",
".",
"Channel",
")",
"{",
"outputLogger",
",",
"errCh",
",",
"err",
":... | // Hot swap logging config by replacing output loggers of passed InfoTraceLogger
// with those built from loggingConfig | [
"Hot",
"swap",
"logging",
"config",
"by",
"replacing",
"output",
"loggers",
"of",
"passed",
"InfoTraceLogger",
"with",
"those",
"built",
"from",
"loggingConfig"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/lifecycle/lifecycle.go#L61-L68 | train |
hyperledger/burrow | execution/evm/abi/abi.go | MergeAbiSpec | func MergeAbiSpec(abiSpec []*AbiSpec) *AbiSpec {
newSpec := AbiSpec{
Events: make(map[string]EventSpec),
EventsById: make(map[EventID]EventSpec),
Functions: make(map[string]FunctionSpec),
}
for _, s := range abiSpec {
for n, f := range s.Functions {
newSpec.Functions[n] = f
}
// Different Abis ... | go | func MergeAbiSpec(abiSpec []*AbiSpec) *AbiSpec {
newSpec := AbiSpec{
Events: make(map[string]EventSpec),
EventsById: make(map[EventID]EventSpec),
Functions: make(map[string]FunctionSpec),
}
for _, s := range abiSpec {
for n, f := range s.Functions {
newSpec.Functions[n] = f
}
// Different Abis ... | [
"func",
"MergeAbiSpec",
"(",
"abiSpec",
"[",
"]",
"*",
"AbiSpec",
")",
"*",
"AbiSpec",
"{",
"newSpec",
":=",
"AbiSpec",
"{",
"Events",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"EventSpec",
")",
",",
"EventsById",
":",
"make",
"(",
"map",
"[",
"Ev... | // MergeAbiSpec takes multiple AbiSpecs and merges them into once structure. Note that
// the same function name or event name can occur in different abis, so there might be
// some information loss. | [
"MergeAbiSpec",
"takes",
"multiple",
"AbiSpecs",
"and",
"merges",
"them",
"into",
"once",
"structure",
".",
"Note",
"that",
"the",
"same",
"function",
"name",
"or",
"event",
"name",
"can",
"occur",
"in",
"different",
"abis",
"so",
"there",
"might",
"be",
"so... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/abi/abi.go#L937-L958 | train |
hyperledger/burrow | execution/evm/abi/abi.go | UnpackRevert | func UnpackRevert(data []byte) (message *string, err error) {
if len(data) > 0 {
var msg string
err = RevertAbi.UnpackWithID(data, &msg)
message = &msg
}
return
} | go | func UnpackRevert(data []byte) (message *string, err error) {
if len(data) > 0 {
var msg string
err = RevertAbi.UnpackWithID(data, &msg)
message = &msg
}
return
} | [
"func",
"UnpackRevert",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"message",
"*",
"string",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"data",
")",
">",
"0",
"{",
"var",
"msg",
"string",
"\n",
"err",
"=",
"RevertAbi",
".",
"UnpackWithID",
"(",... | // UnpackRevert decodes the revert reason if a contract called revert. If no
// reason was given, message will be nil else it will point to the string | [
"UnpackRevert",
"decodes",
"the",
"revert",
"reason",
"if",
"a",
"contract",
"called",
"revert",
".",
"If",
"no",
"reason",
"was",
"given",
"message",
"will",
"be",
"nil",
"else",
"it",
"will",
"point",
"to",
"the",
"string"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/abi/abi.go#L1090-L1097 | train |
hyperledger/burrow | execution/evm/abi/abi.go | pad | func pad(input []byte, size int, left bool) []byte {
if len(input) >= size {
return input[:size]
}
padded := make([]byte, size)
if left {
copy(padded[size-len(input):], input)
} else {
copy(padded, input)
}
return padded
} | go | func pad(input []byte, size int, left bool) []byte {
if len(input) >= size {
return input[:size]
}
padded := make([]byte, size)
if left {
copy(padded[size-len(input):], input)
} else {
copy(padded, input)
}
return padded
} | [
"func",
"pad",
"(",
"input",
"[",
"]",
"byte",
",",
"size",
"int",
",",
"left",
"bool",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"input",
")",
">=",
"size",
"{",
"return",
"input",
"[",
":",
"size",
"]",
"\n",
"}",
"\n",
"padded",
":=",
... | // quick helper padding | [
"quick",
"helper",
"padding"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/abi/abi.go#L1484-L1495 | train |
hyperledger/burrow | permission/base_permissions.go | Get | func (bp BasePermissions) Get(ty PermFlag) (bool, error) {
if ty == 0 {
return false, ErrInvalidPermission(ty)
}
if !bp.IsSet(ty) {
return false, ErrValueNotSet(ty)
}
return bp.Perms&ty == ty, nil
} | go | func (bp BasePermissions) Get(ty PermFlag) (bool, error) {
if ty == 0 {
return false, ErrInvalidPermission(ty)
}
if !bp.IsSet(ty) {
return false, ErrValueNotSet(ty)
}
return bp.Perms&ty == ty, nil
} | [
"func",
"(",
"bp",
"BasePermissions",
")",
"Get",
"(",
"ty",
"PermFlag",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"ty",
"==",
"0",
"{",
"return",
"false",
",",
"ErrInvalidPermission",
"(",
"ty",
")",
"\n",
"}",
"\n",
"if",
"!",
"bp",
".",
... | // Gets the permission value.
// ErrValueNotSet is returned if the permission's set bits are not all on,
// and should be caught by caller so the global permission can be fetched | [
"Gets",
"the",
"permission",
"value",
".",
"ErrValueNotSet",
"is",
"returned",
"if",
"the",
"permission",
"s",
"set",
"bits",
"are",
"not",
"all",
"on",
"and",
"should",
"be",
"caught",
"by",
"caller",
"so",
"the",
"global",
"permission",
"can",
"be",
"fet... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/base_permissions.go#L8-L16 | train |
hyperledger/burrow | permission/base_permissions.go | Set | func (bp *BasePermissions) Set(ty PermFlag, value bool) error {
if ty == 0 {
return ErrInvalidPermission(ty)
}
bp.SetBit |= ty
if value {
bp.Perms |= ty
} else {
bp.Perms &= ^ty
}
return nil
} | go | func (bp *BasePermissions) Set(ty PermFlag, value bool) error {
if ty == 0 {
return ErrInvalidPermission(ty)
}
bp.SetBit |= ty
if value {
bp.Perms |= ty
} else {
bp.Perms &= ^ty
}
return nil
} | [
"func",
"(",
"bp",
"*",
"BasePermissions",
")",
"Set",
"(",
"ty",
"PermFlag",
",",
"value",
"bool",
")",
"error",
"{",
"if",
"ty",
"==",
"0",
"{",
"return",
"ErrInvalidPermission",
"(",
"ty",
")",
"\n",
"}",
"\n",
"bp",
".",
"SetBit",
"|=",
"ty",
"... | // Set a permission bit. Will set the permission's set bit to true. | [
"Set",
"a",
"permission",
"bit",
".",
"Will",
"set",
"the",
"permission",
"s",
"set",
"bit",
"to",
"true",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/base_permissions.go#L19-L30 | train |
hyperledger/burrow | permission/base_permissions.go | Unset | func (bp *BasePermissions) Unset(ty PermFlag) error {
if ty == 0 {
return ErrInvalidPermission(ty)
}
bp.SetBit &= ^ty
return nil
} | go | func (bp *BasePermissions) Unset(ty PermFlag) error {
if ty == 0 {
return ErrInvalidPermission(ty)
}
bp.SetBit &= ^ty
return nil
} | [
"func",
"(",
"bp",
"*",
"BasePermissions",
")",
"Unset",
"(",
"ty",
"PermFlag",
")",
"error",
"{",
"if",
"ty",
"==",
"0",
"{",
"return",
"ErrInvalidPermission",
"(",
"ty",
")",
"\n",
"}",
"\n",
"bp",
".",
"SetBit",
"&=",
"^",
"ty",
"\n",
"return",
... | // Set the permission's set bits to false | [
"Set",
"the",
"permission",
"s",
"set",
"bits",
"to",
"false"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/base_permissions.go#L33-L39 | train |
hyperledger/burrow | permission/base_permissions.go | IsSet | func (bp BasePermissions) IsSet(ty PermFlag) bool {
if ty == 0 {
return false
}
return bp.SetBit&ty == ty
} | go | func (bp BasePermissions) IsSet(ty PermFlag) bool {
if ty == 0 {
return false
}
return bp.SetBit&ty == ty
} | [
"func",
"(",
"bp",
"BasePermissions",
")",
"IsSet",
"(",
"ty",
"PermFlag",
")",
"bool",
"{",
"if",
"ty",
"==",
"0",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"bp",
".",
"SetBit",
"&",
"ty",
"==",
"ty",
"\n",
"}"
] | // Check if the permission is set | [
"Check",
"if",
"the",
"permission",
"is",
"set"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/base_permissions.go#L42-L47 | train |
hyperledger/burrow | permission/base_permissions.go | Compose | func (bp BasePermissions) Compose(bpFallthrough BasePermissions) BasePermissions {
return BasePermissions{
// Combine set perm flags from bp with set perm flags in fallthrough NOT set in bp
Perms: (bp.Perms & bp.SetBit) | (bpFallthrough.Perms & (^bp.SetBit & bpFallthrough.SetBit)),
SetBit: bp.SetBit | bpFallthr... | go | func (bp BasePermissions) Compose(bpFallthrough BasePermissions) BasePermissions {
return BasePermissions{
// Combine set perm flags from bp with set perm flags in fallthrough NOT set in bp
Perms: (bp.Perms & bp.SetBit) | (bpFallthrough.Perms & (^bp.SetBit & bpFallthrough.SetBit)),
SetBit: bp.SetBit | bpFallthr... | [
"func",
"(",
"bp",
"BasePermissions",
")",
"Compose",
"(",
"bpFallthrough",
"BasePermissions",
")",
"BasePermissions",
"{",
"return",
"BasePermissions",
"{",
"// Combine set perm flags from bp with set perm flags in fallthrough NOT set in bp",
"Perms",
":",
"(",
"bp",
".",
... | // Returns a BasePermission that matches any permissions set on this BasePermission
// and falls through to any permissions set on the bpFallthrough | [
"Returns",
"a",
"BasePermission",
"that",
"matches",
"any",
"permissions",
"set",
"on",
"this",
"BasePermission",
"and",
"falls",
"through",
"to",
"any",
"permissions",
"set",
"on",
"the",
"bpFallthrough"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/base_permissions.go#L57-L63 | train |
hyperledger/burrow | core/kernel.go | NewKernel | func NewKernel(dbDir string) (*Kernel, error) {
if dbDir == "" {
return nil, fmt.Errorf("Burrow requires a database directory")
}
runID, err := simpleuuid.NewTime(time.Now()) // Create a random ID based on start time
return &Kernel{
Logger: logging.NewNoopLogger(),
RunID: runID,
Emitter: ... | go | func NewKernel(dbDir string) (*Kernel, error) {
if dbDir == "" {
return nil, fmt.Errorf("Burrow requires a database directory")
}
runID, err := simpleuuid.NewTime(time.Now()) // Create a random ID based on start time
return &Kernel{
Logger: logging.NewNoopLogger(),
RunID: runID,
Emitter: ... | [
"func",
"NewKernel",
"(",
"dbDir",
"string",
")",
"(",
"*",
"Kernel",
",",
"error",
")",
"{",
"if",
"dbDir",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"runID",
",",
"err",
":=",
"s... | // NewKernel initializes an empty kernel | [
"NewKernel",
"initializes",
"an",
"empty",
"kernel"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L85-L100 | train |
hyperledger/burrow | core/kernel.go | SetLogger | func (kern *Kernel) SetLogger(logger *logging.Logger) {
logger = logger.WithScope("NewKernel()").With(structure.TimeKey,
log.DefaultTimestampUTC, structure.RunId, kern.RunID.String())
heightValuer := log.Valuer(func() interface{} { return kern.Blockchain.LastBlockHeight() })
kern.Logger = logger.WithInfo(structure... | go | func (kern *Kernel) SetLogger(logger *logging.Logger) {
logger = logger.WithScope("NewKernel()").With(structure.TimeKey,
log.DefaultTimestampUTC, structure.RunId, kern.RunID.String())
heightValuer := log.Valuer(func() interface{} { return kern.Blockchain.LastBlockHeight() })
kern.Logger = logger.WithInfo(structure... | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"SetLogger",
"(",
"logger",
"*",
"logging",
".",
"Logger",
")",
"{",
"logger",
"=",
"logger",
".",
"WithScope",
"(",
"\"",
"\"",
")",
".",
"With",
"(",
"structure",
".",
"TimeKey",
",",
"log",
".",
"DefaultTim... | // SetLogger initializes the kernel with the provided logger | [
"SetLogger",
"initializes",
"the",
"kernel",
"with",
"the",
"provided",
"logger"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L103-L109 | train |
hyperledger/burrow | core/kernel.go | LoadState | func (kern *Kernel) LoadState(genesisDoc *genesis.GenesisDoc) (err error) {
var existing bool
existing, kern.Blockchain, err = bcm.LoadOrNewBlockchain(kern.database, genesisDoc, kern.Logger)
if err != nil {
return fmt.Errorf("error creating or loading blockchain state: %v", err)
}
if existing {
kern.Logger.In... | go | func (kern *Kernel) LoadState(genesisDoc *genesis.GenesisDoc) (err error) {
var existing bool
existing, kern.Blockchain, err = bcm.LoadOrNewBlockchain(kern.database, genesisDoc, kern.Logger)
if err != nil {
return fmt.Errorf("error creating or loading blockchain state: %v", err)
}
if existing {
kern.Logger.In... | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"LoadState",
"(",
"genesisDoc",
"*",
"genesis",
".",
"GenesisDoc",
")",
"(",
"err",
"error",
")",
"{",
"var",
"existing",
"bool",
"\n",
"existing",
",",
"kern",
".",
"Blockchain",
",",
"err",
"=",
"bcm",
".",
... | // LoadState starts from scratch or previous chain | [
"LoadState",
"starts",
"from",
"scratch",
"or",
"previous",
"chain"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L112-L151 | train |
hyperledger/burrow | core/kernel.go | LoadDump | func (kern *Kernel) LoadDump(genesisDoc *genesis.GenesisDoc, restoreFile string, silent bool) (err error) {
var exists bool
if exists, kern.Blockchain, err = bcm.LoadOrNewBlockchain(kern.database, genesisDoc, kern.Logger); err != nil {
return fmt.Errorf("error creating or loading blockchain state: %v", err)
}
if... | go | func (kern *Kernel) LoadDump(genesisDoc *genesis.GenesisDoc, restoreFile string, silent bool) (err error) {
var exists bool
if exists, kern.Blockchain, err = bcm.LoadOrNewBlockchain(kern.database, genesisDoc, kern.Logger); err != nil {
return fmt.Errorf("error creating or loading blockchain state: %v", err)
}
if... | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"LoadDump",
"(",
"genesisDoc",
"*",
"genesis",
".",
"GenesisDoc",
",",
"restoreFile",
"string",
",",
"silent",
"bool",
")",
"(",
"err",
"error",
")",
"{",
"var",
"exists",
"bool",
"\n",
"if",
"exists",
",",
"ker... | // LoadDump restores chain state from the given dump file | [
"LoadDump",
"restores",
"chain",
"state",
"from",
"the",
"given",
"dump",
"file"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L154-L203 | train |
hyperledger/burrow | core/kernel.go | GetNodeView | func (kern *Kernel) GetNodeView() (*tendermint.NodeView, error) {
if kern.Node == nil {
return nil, nil
}
return tendermint.NewNodeView(kern.Node, kern.txCodec, kern.RunID)
} | go | func (kern *Kernel) GetNodeView() (*tendermint.NodeView, error) {
if kern.Node == nil {
return nil, nil
}
return tendermint.NewNodeView(kern.Node, kern.txCodec, kern.RunID)
} | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"GetNodeView",
"(",
")",
"(",
"*",
"tendermint",
".",
"NodeView",
",",
"error",
")",
"{",
"if",
"kern",
".",
"Node",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"tendermint",
".... | // GetNodeView builds and returns a wrapper of our tendermint node | [
"GetNodeView",
"builds",
"and",
"returns",
"a",
"wrapper",
"of",
"our",
"tendermint",
"node"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L206-L211 | train |
hyperledger/burrow | core/kernel.go | AddExecutionOptions | func (kern *Kernel) AddExecutionOptions(opts ...execution.ExecutionOption) {
kern.exeOptions = append(kern.exeOptions, opts...)
} | go | func (kern *Kernel) AddExecutionOptions(opts ...execution.ExecutionOption) {
kern.exeOptions = append(kern.exeOptions, opts...)
} | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"AddExecutionOptions",
"(",
"opts",
"...",
"execution",
".",
"ExecutionOption",
")",
"{",
"kern",
".",
"exeOptions",
"=",
"append",
"(",
"kern",
".",
"exeOptions",
",",
"opts",
"...",
")",
"\n",
"}"
] | // AddExecutionOptions extends our execution options | [
"AddExecutionOptions",
"extends",
"our",
"execution",
"options"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L214-L216 | train |
hyperledger/burrow | core/kernel.go | AddProcesses | func (kern *Kernel) AddProcesses(pl ...process.Launcher) {
kern.Launchers = append(kern.Launchers, pl...)
} | go | func (kern *Kernel) AddProcesses(pl ...process.Launcher) {
kern.Launchers = append(kern.Launchers, pl...)
} | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"AddProcesses",
"(",
"pl",
"...",
"process",
".",
"Launcher",
")",
"{",
"kern",
".",
"Launchers",
"=",
"append",
"(",
"kern",
".",
"Launchers",
",",
"pl",
"...",
")",
"\n",
"}"
] | // AddProcesses extends the services that we launch at boot | [
"AddProcesses",
"extends",
"the",
"services",
"that",
"we",
"launch",
"at",
"boot"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L219-L221 | train |
hyperledger/burrow | core/kernel.go | Boot | func (kern *Kernel) Boot() (err error) {
for _, launcher := range kern.Launchers {
if launcher.Enabled {
srvr, err := launcher.Launch()
if err != nil {
return fmt.Errorf("error launching %s server: %v", launcher.Name, err)
}
kern.processes[launcher.Name] = srvr
}
}
go kern.supervise()
return ni... | go | func (kern *Kernel) Boot() (err error) {
for _, launcher := range kern.Launchers {
if launcher.Enabled {
srvr, err := launcher.Launch()
if err != nil {
return fmt.Errorf("error launching %s server: %v", launcher.Name, err)
}
kern.processes[launcher.Name] = srvr
}
}
go kern.supervise()
return ni... | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"Boot",
"(",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"launcher",
":=",
"range",
"kern",
".",
"Launchers",
"{",
"if",
"launcher",
".",
"Enabled",
"{",
"srvr",
",",
"err",
":=",
"launcher",
".",
... | // Boot the kernel starting Tendermint and RPC layers | [
"Boot",
"the",
"kernel",
"starting",
"Tendermint",
"and",
"RPC",
"layers"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L247-L260 | train |
hyperledger/burrow | core/kernel.go | supervise | func (kern *Kernel) supervise() {
// perform disaster restarts of the kernel; rejoining the network as if we were a new node.
shutdownCh := make(chan os.Signal, 1)
reloadCh := make(chan os.Signal, 1)
syncCh := make(chan os.Signal, 1)
signal.Notify(shutdownCh, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL)
sign... | go | func (kern *Kernel) supervise() {
// perform disaster restarts of the kernel; rejoining the network as if we were a new node.
shutdownCh := make(chan os.Signal, 1)
reloadCh := make(chan os.Signal, 1)
syncCh := make(chan os.Signal, 1)
signal.Notify(shutdownCh, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL)
sign... | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"supervise",
"(",
")",
"{",
"// perform disaster restarts of the kernel; rejoining the network as if we were a new node.",
"shutdownCh",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"reloadCh",
":=",
"... | // Supervise kernel once booted | [
"Supervise",
"kernel",
"once",
"booted"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L311-L338 | train |
hyperledger/burrow | core/kernel.go | Shutdown | func (kern *Kernel) Shutdown(ctx context.Context) (err error) {
kern.shutdownOnce.Do(func() {
logger := kern.Logger.WithScope("Shutdown")
logger.InfoMsg("Attempting graceful shutdown...")
logger.InfoMsg("Shutting down servers")
// Shutdown servers in reverse order to boot
for i := len(kern.Launchers) - 1; i ... | go | func (kern *Kernel) Shutdown(ctx context.Context) (err error) {
kern.shutdownOnce.Do(func() {
logger := kern.Logger.WithScope("Shutdown")
logger.InfoMsg("Attempting graceful shutdown...")
logger.InfoMsg("Shutting down servers")
// Shutdown servers in reverse order to boot
for i := len(kern.Launchers) - 1; i ... | [
"func",
"(",
"kern",
"*",
"Kernel",
")",
"Shutdown",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"kern",
".",
"shutdownOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"logger",
":=",
"kern",
".",
"Logger",
".",
"WithSco... | // Shutdown stops the kernel allowing for a graceful shutdown of components in order | [
"Shutdown",
"stops",
"the",
"kernel",
"allowing",
"for",
"a",
"graceful",
"shutdown",
"of",
"components",
"in",
"order"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/core/kernel.go#L352-L384 | train |
hyperledger/burrow | deploy/jobs/jobs_transact.go | registerNameTx | func registerNameTx(name *def.RegisterName, do *def.DeployArgs, account string, client *def.Client, logger *logging.Logger) (*payload.NameTx, error) {
// Set Defaults
name.Source = useDefault(name.Source, account)
name.Fee = useDefault(name.Fee, do.DefaultFee)
name.Amount = useDefault(name.Amount, do.DefaultAmount)... | go | func registerNameTx(name *def.RegisterName, do *def.DeployArgs, account string, client *def.Client, logger *logging.Logger) (*payload.NameTx, error) {
// Set Defaults
name.Source = useDefault(name.Source, account)
name.Fee = useDefault(name.Fee, do.DefaultFee)
name.Amount = useDefault(name.Amount, do.DefaultAmount)... | [
"func",
"registerNameTx",
"(",
"name",
"*",
"def",
".",
"RegisterName",
",",
"do",
"*",
"def",
".",
"DeployArgs",
",",
"account",
"string",
",",
"client",
"*",
"def",
".",
"Client",
",",
"logger",
"*",
"logging",
".",
"Logger",
")",
"(",
"*",
"payload"... | // Runs an individual nametx. | [
"Runs",
"an",
"individual",
"nametx",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/jobs/jobs_transact.go#L137-L157 | train |
hyperledger/burrow | vent/service/decoder.go | decodeEvent | func decodeEvent(header *exec.Header, log *exec.LogEvent, abiSpec *abi.AbiSpec) (map[string]interface{}, error) {
// to prepare decoded data and map to event item name
data := make(map[string]interface{})
var eventID abi.EventID
copy(eventID[:], log.Topics[0].Bytes())
evAbi, ok := abiSpec.EventsById[eventID]
if... | go | func decodeEvent(header *exec.Header, log *exec.LogEvent, abiSpec *abi.AbiSpec) (map[string]interface{}, error) {
// to prepare decoded data and map to event item name
data := make(map[string]interface{})
var eventID abi.EventID
copy(eventID[:], log.Topics[0].Bytes())
evAbi, ok := abiSpec.EventsById[eventID]
if... | [
"func",
"decodeEvent",
"(",
"header",
"*",
"exec",
".",
"Header",
",",
"log",
"*",
"exec",
".",
"LogEvent",
",",
"abiSpec",
"*",
"abi",
".",
"AbiSpec",
")",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// to prepare... | // decodeEvent unpacks & decodes event data | [
"decodeEvent",
"unpacks",
"&",
"decodes",
"event",
"data"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/service/decoder.go#L15-L56 | train |
hyperledger/burrow | execution/execution.go | NewBatchChecker | func NewBatchChecker(backend ExecutorState, params Params, blockchain contexts.Blockchain, logger *logging.Logger,
options ...ExecutionOption) BatchExecutor {
return newExecutor("CheckCache", false, params, backend, blockchain, nil,
logger.WithScope("NewBatchExecutor"), options...)
} | go | func NewBatchChecker(backend ExecutorState, params Params, blockchain contexts.Blockchain, logger *logging.Logger,
options ...ExecutionOption) BatchExecutor {
return newExecutor("CheckCache", false, params, backend, blockchain, nil,
logger.WithScope("NewBatchExecutor"), options...)
} | [
"func",
"NewBatchChecker",
"(",
"backend",
"ExecutorState",
",",
"params",
"Params",
",",
"blockchain",
"contexts",
".",
"Blockchain",
",",
"logger",
"*",
"logging",
".",
"Logger",
",",
"options",
"...",
"ExecutionOption",
")",
"BatchExecutor",
"{",
"return",
"n... | // Wraps a cache of what is variously known as the 'check cache' and 'mempool' | [
"Wraps",
"a",
"cache",
"of",
"what",
"is",
"variously",
"known",
"as",
"the",
"check",
"cache",
"and",
"mempool"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/execution.go#L114-L119 | train |
hyperledger/burrow | execution/execution.go | Commit | func (exe *executor) Commit(header *abciTypes.Header) (stateHash []byte, err error) {
// The write lock to the executor is controlled by the caller (e.g. abci.App) so we do not acquire it here to avoid
// deadlock
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("recovered from panic in executor.Co... | go | func (exe *executor) Commit(header *abciTypes.Header) (stateHash []byte, err error) {
// The write lock to the executor is controlled by the caller (e.g. abci.App) so we do not acquire it here to avoid
// deadlock
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("recovered from panic in executor.Co... | [
"func",
"(",
"exe",
"*",
"executor",
")",
"Commit",
"(",
"header",
"*",
"abciTypes",
".",
"Header",
")",
"(",
"stateHash",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"// The write lock to the executor is controlled by the caller (e.g. abci.App) so we do not acqu... | // Commit the current state - optionally pass in the tendermint ABCI header for that to be included with the BeginBlock
// StreamEvent | [
"Commit",
"the",
"current",
"state",
"-",
"optionally",
"pass",
"in",
"the",
"tendermint",
"ABCI",
"header",
"for",
"that",
"to",
"be",
"included",
"with",
"the",
"BeginBlock",
"StreamEvent"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/execution.go#L301-L354 | train |
hyperledger/burrow | execution/execution.go | updateSignatories | func (exe *executor) updateSignatories(txEnv *txs.Envelope) error {
for _, sig := range txEnv.Signatories {
// pointer dereferences are safe since txEnv.Validate() is run by txEnv.Verify() above which checks they are
// non-nil
acc, err := exe.stateCache.GetAccount(*sig.Address)
if err != nil {
return fmt.E... | go | func (exe *executor) updateSignatories(txEnv *txs.Envelope) error {
for _, sig := range txEnv.Signatories {
// pointer dereferences are safe since txEnv.Validate() is run by txEnv.Verify() above which checks they are
// non-nil
acc, err := exe.stateCache.GetAccount(*sig.Address)
if err != nil {
return fmt.E... | [
"func",
"(",
"exe",
"*",
"executor",
")",
"updateSignatories",
"(",
"txEnv",
"*",
"txs",
".",
"Envelope",
")",
"error",
"{",
"for",
"_",
",",
"sig",
":=",
"range",
"txEnv",
".",
"Signatories",
"{",
"// pointer dereferences are safe since txEnv.Validate() is run by... | // Capture public keys and update sequence numbers | [
"Capture",
"public",
"keys",
"and",
"update",
"sequence",
"numbers"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/execution.go#L405-L433 | train |
hyperledger/burrow | crypto/tendermint.go | ABCIPubKey | func (p PublicKey) ABCIPubKey() abci.PubKey {
return abci.PubKey{
Type: p.CurveType.ABCIType(),
Data: p.PublicKey,
}
} | go | func (p PublicKey) ABCIPubKey() abci.PubKey {
return abci.PubKey{
Type: p.CurveType.ABCIType(),
Data: p.PublicKey,
}
} | [
"func",
"(",
"p",
"PublicKey",
")",
"ABCIPubKey",
"(",
")",
"abci",
".",
"PubKey",
"{",
"return",
"abci",
".",
"PubKey",
"{",
"Type",
":",
"p",
".",
"CurveType",
".",
"ABCIType",
"(",
")",
",",
"Data",
":",
"p",
".",
"PublicKey",
",",
"}",
"\n",
... | // PublicKey extensions
// Return the ABCI PubKey. See Tendermint protobuf.go for the go-crypto conversion this is based on | [
"PublicKey",
"extensions",
"Return",
"the",
"ABCI",
"PubKey",
".",
"See",
"Tendermint",
"protobuf",
".",
"go",
"for",
"the",
"go",
"-",
"crypto",
"conversion",
"this",
"is",
"based",
"on"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/crypto/tendermint.go#L42-L47 | train |
hyperledger/burrow | vent/sqlsol/spec_loader.go | SpecLoader | func SpecLoader(specFileOrDirs []string, createBlkTxTables bool) (*Projection, error) {
var projection *Projection
var err error
if len(specFileOrDirs) == 0 {
return nil, fmt.Errorf("please provide a spec file or directory")
}
projection, err = NewProjectionFromFolder(specFileOrDirs...)
if err != nil {
retu... | go | func SpecLoader(specFileOrDirs []string, createBlkTxTables bool) (*Projection, error) {
var projection *Projection
var err error
if len(specFileOrDirs) == 0 {
return nil, fmt.Errorf("please provide a spec file or directory")
}
projection, err = NewProjectionFromFolder(specFileOrDirs...)
if err != nil {
retu... | [
"func",
"SpecLoader",
"(",
"specFileOrDirs",
"[",
"]",
"string",
",",
"createBlkTxTables",
"bool",
")",
"(",
"*",
"Projection",
",",
"error",
")",
"{",
"var",
"projection",
"*",
"Projection",
"\n",
"var",
"err",
"error",
"\n\n",
"if",
"len",
"(",
"specFile... | // SpecLoader loads spec files and parses them | [
"SpecLoader",
"loads",
"spec",
"files",
"and",
"parses",
"them"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/spec_loader.go#L11-L35 | train |
hyperledger/burrow | vent/sqlsol/spec_loader.go | getBlockTxTablesDefinition | func getBlockTxTablesDefinition() types.EventTables {
return types.EventTables{
types.SQLBlockTableName: &types.SQLTable{
Name: types.SQLBlockTableName,
Columns: []*types.SQLTableColumn{
{
Name: types.SQLColumnLabelHeight,
Type: types.SQLColumnTypeVarchar,
Length: 100,
Primary: t... | go | func getBlockTxTablesDefinition() types.EventTables {
return types.EventTables{
types.SQLBlockTableName: &types.SQLTable{
Name: types.SQLBlockTableName,
Columns: []*types.SQLTableColumn{
{
Name: types.SQLColumnLabelHeight,
Type: types.SQLColumnTypeVarchar,
Length: 100,
Primary: t... | [
"func",
"getBlockTxTablesDefinition",
"(",
")",
"types",
".",
"EventTables",
"{",
"return",
"types",
".",
"EventTables",
"{",
"types",
".",
"SQLBlockTableName",
":",
"&",
"types",
".",
"SQLTable",
"{",
"Name",
":",
"types",
".",
"SQLBlockTableName",
",",
"Colu... | // getBlockTxTablesDefinition returns block & transaction structures | [
"getBlockTxTablesDefinition",
"returns",
"block",
"&",
"transaction",
"structures"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqlsol/spec_loader.go#L38-L113 | train |
hyperledger/burrow | execution/evm/abi/core.go | DecodeFunctionReturnFromFile | func DecodeFunctionReturnFromFile(abiLocation, binPath, funcName string, resultRaw []byte, logger *logging.Logger) ([]*Variable, error) {
abiSpecBytes, err := readAbi(binPath, abiLocation, logger)
if err != nil {
return nil, err
}
logger.TraceMsg("ABI Specification (Decode)", "spec", abiSpecBytes)
// Unpack the... | go | func DecodeFunctionReturnFromFile(abiLocation, binPath, funcName string, resultRaw []byte, logger *logging.Logger) ([]*Variable, error) {
abiSpecBytes, err := readAbi(binPath, abiLocation, logger)
if err != nil {
return nil, err
}
logger.TraceMsg("ABI Specification (Decode)", "spec", abiSpecBytes)
// Unpack the... | [
"func",
"DecodeFunctionReturnFromFile",
"(",
"abiLocation",
",",
"binPath",
",",
"funcName",
"string",
",",
"resultRaw",
"[",
"]",
"byte",
",",
"logger",
"*",
"logging",
".",
"Logger",
")",
"(",
"[",
"]",
"*",
"Variable",
",",
"error",
")",
"{",
"abiSpecBy... | // DecodeFunctionReturnFromFile ABI decodes the return value from a contract function call. | [
"DecodeFunctionReturnFromFile",
"ABI",
"decodes",
"the",
"return",
"value",
"from",
"a",
"contract",
"function",
"call",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/abi/core.go#L88-L97 | train |
hyperledger/burrow | execution/evm/abi/core.go | LoadPath | func LoadPath(abiFileOrDirs ...string) (*AbiSpec, error) {
if len(abiFileOrDirs) == 0 {
return &AbiSpec{}, fmt.Errorf("no ABI file or directory provided")
}
specs := make([]*AbiSpec, 0)
for _, dir := range abiFileOrDirs {
err := filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
if err... | go | func LoadPath(abiFileOrDirs ...string) (*AbiSpec, error) {
if len(abiFileOrDirs) == 0 {
return &AbiSpec{}, fmt.Errorf("no ABI file or directory provided")
}
specs := make([]*AbiSpec, 0)
for _, dir := range abiFileOrDirs {
err := filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
if err... | [
"func",
"LoadPath",
"(",
"abiFileOrDirs",
"...",
"string",
")",
"(",
"*",
"AbiSpec",
",",
"error",
")",
"{",
"if",
"len",
"(",
"abiFileOrDirs",
")",
"==",
"0",
"{",
"return",
"&",
"AbiSpec",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")"... | // LoadPath loads one abi file or finds all files in a directory | [
"LoadPath",
"loads",
"one",
"abi",
"file",
"or",
"finds",
"all",
"files",
"in",
"a",
"directory"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/evm/abi/core.go#L165-L195 | train |
hyperledger/burrow | consensus/tendermint/node_view.go | MempoolTransactions | func (nv *NodeView) MempoolTransactions(maxTxs int) ([]*txs.Envelope, error) {
var transactions []*txs.Envelope
for _, txBytes := range nv.tmNode.MempoolReactor().Mempool.ReapMaxTxs(maxTxs) {
txEnv, err := nv.txDecoder.DecodeTx(txBytes)
if err != nil {
return nil, err
}
transactions = append(transactions, ... | go | func (nv *NodeView) MempoolTransactions(maxTxs int) ([]*txs.Envelope, error) {
var transactions []*txs.Envelope
for _, txBytes := range nv.tmNode.MempoolReactor().Mempool.ReapMaxTxs(maxTxs) {
txEnv, err := nv.txDecoder.DecodeTx(txBytes)
if err != nil {
return nil, err
}
transactions = append(transactions, ... | [
"func",
"(",
"nv",
"*",
"NodeView",
")",
"MempoolTransactions",
"(",
"maxTxs",
"int",
")",
"(",
"[",
"]",
"*",
"txs",
".",
"Envelope",
",",
"error",
")",
"{",
"var",
"transactions",
"[",
"]",
"*",
"txs",
".",
"Envelope",
"\n",
"for",
"_",
",",
"txB... | // Pass -1 to get all available transactions | [
"Pass",
"-",
"1",
"to",
"get",
"all",
"available",
"transactions"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/consensus/tendermint/node_view.go#L85-L95 | train |
hyperledger/burrow | genesis/spec/presets.go | FullAccount | func FullAccount(name string) GenesisSpec {
// Inheriting from the arbitrary figures used by monax tool for now
amount := uint64(99999999999999)
Power := uint64(9999999999)
return GenesisSpec{
Accounts: []TemplateAccount{{
Name: name,
Amounts: balance.New().Native(amount).Power(Power),
Permiss... | go | func FullAccount(name string) GenesisSpec {
// Inheriting from the arbitrary figures used by monax tool for now
amount := uint64(99999999999999)
Power := uint64(9999999999)
return GenesisSpec{
Accounts: []TemplateAccount{{
Name: name,
Amounts: balance.New().Native(amount).Power(Power),
Permiss... | [
"func",
"FullAccount",
"(",
"name",
"string",
")",
"GenesisSpec",
"{",
"// Inheriting from the arbitrary figures used by monax tool for now",
"amount",
":=",
"uint64",
"(",
"99999999999999",
")",
"\n",
"Power",
":=",
"uint64",
"(",
"9999999999",
")",
"\n",
"return",
"... | // Files here can be used as starting points for building various 'chain types' but are otherwise
// a fairly unprincipled collection of GenesisSpecs that we find useful in testing and development | [
"Files",
"here",
"can",
"be",
"used",
"as",
"starting",
"points",
"for",
"building",
"various",
"chain",
"types",
"but",
"are",
"otherwise",
"a",
"fairly",
"unprincipled",
"collection",
"of",
"GenesisSpecs",
"that",
"we",
"find",
"useful",
"in",
"testing",
"an... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/genesis/spec/presets.go#L13-L25 | train |
hyperledger/burrow | genesis/spec/presets.go | mergeAccounts | func mergeAccounts(bases, overrides []TemplateAccount) []TemplateAccount {
indexOfBase := make(map[string]int, len(bases))
for i, ta := range bases {
if ta.Name != "" {
indexOfBase[ta.Name] = i
}
}
for _, override := range overrides {
if override.Name != "" {
if i, ok := indexOfBase[override.Name]; ok ... | go | func mergeAccounts(bases, overrides []TemplateAccount) []TemplateAccount {
indexOfBase := make(map[string]int, len(bases))
for i, ta := range bases {
if ta.Name != "" {
indexOfBase[ta.Name] = i
}
}
for _, override := range overrides {
if override.Name != "" {
if i, ok := indexOfBase[override.Name]; ok ... | [
"func",
"mergeAccounts",
"(",
"bases",
",",
"overrides",
"[",
"]",
"TemplateAccount",
")",
"[",
"]",
"TemplateAccount",
"{",
"indexOfBase",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"len",
"(",
"bases",
")",
")",
"\n",
"for",
"i",
",",
... | // Merge accounts by adding to base list or updating previously named account | [
"Merge",
"accounts",
"by",
"adding",
"to",
"base",
"list",
"or",
"updating",
"previously",
"named",
"account"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/genesis/spec/presets.go#L117-L135 | train |
hyperledger/burrow | keys/core.go | getNameAddr | func getNameAddr(keysDir, name, addr string) (string, error) {
if name == "" && addr == "" {
return "", fmt.Errorf("at least one of name or addr must be provided")
}
// name takes precedent if both are given
var err error
if name != "" {
addr, err = coreNameGet(keysDir, name)
if err != nil {
return "", e... | go | func getNameAddr(keysDir, name, addr string) (string, error) {
if name == "" && addr == "" {
return "", fmt.Errorf("at least one of name or addr must be provided")
}
// name takes precedent if both are given
var err error
if name != "" {
addr, err = coreNameGet(keysDir, name)
if err != nil {
return "", e... | [
"func",
"getNameAddr",
"(",
"keysDir",
",",
"name",
",",
"addr",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"&&",
"addr",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\""... | // return addr from name or addr | [
"return",
"addr",
"from",
"name",
"or",
"addr"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/keys/core.go#L135-L149 | train |
hyperledger/burrow | deploy/run_deploy.go | RunPlaybooks | func RunPlaybooks(args *def.DeployArgs, playbooks []string, logger *logging.Logger) (int, error) {
// if bin and abi paths are default cli settings then use the
// stated defaults of do.Path plus bin|abi
if args.Path == "" {
var err error
args.Path, err = os.Getwd()
if err != nil {
panic(fmt.Sprintf("fail... | go | func RunPlaybooks(args *def.DeployArgs, playbooks []string, logger *logging.Logger) (int, error) {
// if bin and abi paths are default cli settings then use the
// stated defaults of do.Path plus bin|abi
if args.Path == "" {
var err error
args.Path, err = os.Getwd()
if err != nil {
panic(fmt.Sprintf("fail... | [
"func",
"RunPlaybooks",
"(",
"args",
"*",
"def",
".",
"DeployArgs",
",",
"playbooks",
"[",
"]",
"string",
",",
"logger",
"*",
"logging",
".",
"Logger",
")",
"(",
"int",
",",
"error",
")",
"{",
"// if bin and abi paths are default cli settings then use the",
"// ... | // RunPlaybooks starts workers, and loads the playbooks in parallel in the workers, and executes them. | [
"RunPlaybooks",
"starts",
"workers",
"and",
"loads",
"the",
"playbooks",
"in",
"parallel",
"in",
"the",
"workers",
"and",
"executes",
"them",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/deploy/run_deploy.go#L82-L167 | train |
hyperledger/burrow | bcm/blockchain.go | LoadOrNewBlockchain | func LoadOrNewBlockchain(db dbm.DB, genesisDoc *genesis.GenesisDoc, logger *logging.Logger) (bool, *Blockchain, error) {
logger = logger.WithScope("LoadOrNewBlockchain")
logger.InfoMsg("Trying to load blockchain state from database",
"database_key", stateKey)
bc, err := loadBlockchain(db)
if err != nil {
return... | go | func LoadOrNewBlockchain(db dbm.DB, genesisDoc *genesis.GenesisDoc, logger *logging.Logger) (bool, *Blockchain, error) {
logger = logger.WithScope("LoadOrNewBlockchain")
logger.InfoMsg("Trying to load blockchain state from database",
"database_key", stateKey)
bc, err := loadBlockchain(db)
if err != nil {
return... | [
"func",
"LoadOrNewBlockchain",
"(",
"db",
"dbm",
".",
"DB",
",",
"genesisDoc",
"*",
"genesis",
".",
"GenesisDoc",
",",
"logger",
"*",
"logging",
".",
"Logger",
")",
"(",
"bool",
",",
"*",
"Blockchain",
",",
"error",
")",
"{",
"logger",
"=",
"logger",
"... | // LoadOrNewBlockchain returns true if state already exists | [
"LoadOrNewBlockchain",
"returns",
"true",
"if",
"state",
"already",
"exists"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/bcm/blockchain.go#L73-L94 | train |
hyperledger/burrow | bcm/blockchain.go | NewBlockchain | func NewBlockchain(db dbm.DB, genesisDoc *genesis.GenesisDoc) *Blockchain {
bc := &Blockchain{
db: db,
genesisHash: genesisDoc.Hash(),
genesisDoc: *genesisDoc,
chainID: genesisDoc.ChainID(),
lastBlockTime: genesisDoc.GenesisTime,
appHashAfterLas... | go | func NewBlockchain(db dbm.DB, genesisDoc *genesis.GenesisDoc) *Blockchain {
bc := &Blockchain{
db: db,
genesisHash: genesisDoc.Hash(),
genesisDoc: *genesisDoc,
chainID: genesisDoc.ChainID(),
lastBlockTime: genesisDoc.GenesisTime,
appHashAfterLas... | [
"func",
"NewBlockchain",
"(",
"db",
"dbm",
".",
"DB",
",",
"genesisDoc",
"*",
"genesis",
".",
"GenesisDoc",
")",
"*",
"Blockchain",
"{",
"bc",
":=",
"&",
"Blockchain",
"{",
"db",
":",
"db",
",",
"genesisHash",
":",
"genesisDoc",
".",
"Hash",
"(",
")",
... | // NewBlockchain returns a pointer to blockchain state initialised from genesis | [
"NewBlockchain",
"returns",
"a",
"pointer",
"to",
"blockchain",
"state",
"initialised",
"from",
"genesis"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/bcm/blockchain.go#L97-L107 | train |
hyperledger/burrow | vent/types/sql_column_type.go | IsNumeric | func (ct SQLColumnType) IsNumeric() bool {
return ct == SQLColumnTypeInt || ct == SQLColumnTypeSerial || ct == SQLColumnTypeNumeric || ct == SQLColumnTypeBigInt
} | go | func (ct SQLColumnType) IsNumeric() bool {
return ct == SQLColumnTypeInt || ct == SQLColumnTypeSerial || ct == SQLColumnTypeNumeric || ct == SQLColumnTypeBigInt
} | [
"func",
"(",
"ct",
"SQLColumnType",
")",
"IsNumeric",
"(",
")",
"bool",
"{",
"return",
"ct",
"==",
"SQLColumnTypeInt",
"||",
"ct",
"==",
"SQLColumnTypeSerial",
"||",
"ct",
"==",
"SQLColumnTypeNumeric",
"||",
"ct",
"==",
"SQLColumnTypeBigInt",
"\n",
"}"
] | // IsNumeric determines if an sqlColumnType is numeric | [
"IsNumeric",
"determines",
"if",
"an",
"sqlColumnType",
"is",
"numeric"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/types/sql_column_type.go#L47-L49 | train |
hyperledger/burrow | permission/util.go | ConvertPermissionsMapAndRolesToAccountPermissions | func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]bool,
roles []string) (*AccountPermissions, error) {
var err error
accountPermissions := &AccountPermissions{}
accountPermissions.Base, err = convertPermissionsMapStringIntToBasePermissions(permissions)
if err != nil {
return nil, err
... | go | func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]bool,
roles []string) (*AccountPermissions, error) {
var err error
accountPermissions := &AccountPermissions{}
accountPermissions.Base, err = convertPermissionsMapStringIntToBasePermissions(permissions)
if err != nil {
return nil, err
... | [
"func",
"ConvertPermissionsMapAndRolesToAccountPermissions",
"(",
"permissions",
"map",
"[",
"string",
"]",
"bool",
",",
"roles",
"[",
"]",
"string",
")",
"(",
"*",
"AccountPermissions",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"accountPermissions",
... | // ConvertMapStringIntToPermissions converts a map of string-bool pairs and a slice of
// strings for the roles to an AccountPermissions type. If the value in the
// permissions map is true for a particular permission string then the permission
// will be set in the AccountsPermissions. For all unmentioned permissions ... | [
"ConvertMapStringIntToPermissions",
"converts",
"a",
"map",
"of",
"string",
"-",
"bool",
"pairs",
"and",
"a",
"slice",
"of",
"strings",
"for",
"the",
"roles",
"to",
"an",
"AccountPermissions",
"type",
".",
"If",
"the",
"value",
"in",
"the",
"permissions",
"map... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/util.go#L26-L36 | train |
hyperledger/burrow | permission/util.go | convertPermissionsMapStringIntToBasePermissions | func convertPermissionsMapStringIntToBasePermissions(permissions map[string]bool) (BasePermissions, error) {
// initialise basePermissions as ZeroBasePermissions
basePermissions := ZeroBasePermissions
for permissionName, value := range permissions {
permissionsFlag, err := PermStringToFlag(permissionName)
if er... | go | func convertPermissionsMapStringIntToBasePermissions(permissions map[string]bool) (BasePermissions, error) {
// initialise basePermissions as ZeroBasePermissions
basePermissions := ZeroBasePermissions
for permissionName, value := range permissions {
permissionsFlag, err := PermStringToFlag(permissionName)
if er... | [
"func",
"convertPermissionsMapStringIntToBasePermissions",
"(",
"permissions",
"map",
"[",
"string",
"]",
"bool",
")",
"(",
"BasePermissions",
",",
"error",
")",
"{",
"// initialise basePermissions as ZeroBasePermissions",
"basePermissions",
":=",
"ZeroBasePermissions",
"\n\n... | // convertPermissionsMapStringIntToBasePermissions converts a map of string-bool
// pairs to BasePermissions. | [
"convertPermissionsMapStringIntToBasePermissions",
"converts",
"a",
"map",
"of",
"string",
"-",
"bool",
"pairs",
"to",
"BasePermissions",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/util.go#L40-L54 | train |
hyperledger/burrow | permission/util.go | BasePermissionsFromStringList | func BasePermissionsFromStringList(permissions []string) (BasePermissions, error) {
permFlag, err := PermFlagFromStringList(permissions)
if err != nil {
return ZeroBasePermissions, err
}
return BasePermissions{
Perms: permFlag,
SetBit: permFlag,
}, nil
} | go | func BasePermissionsFromStringList(permissions []string) (BasePermissions, error) {
permFlag, err := PermFlagFromStringList(permissions)
if err != nil {
return ZeroBasePermissions, err
}
return BasePermissions{
Perms: permFlag,
SetBit: permFlag,
}, nil
} | [
"func",
"BasePermissionsFromStringList",
"(",
"permissions",
"[",
"]",
"string",
")",
"(",
"BasePermissions",
",",
"error",
")",
"{",
"permFlag",
",",
"err",
":=",
"PermFlagFromStringList",
"(",
"permissions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return"... | // Builds a composite BasePermission by creating a PermFlag from permissions strings and
// setting them all | [
"Builds",
"a",
"composite",
"BasePermission",
"by",
"creating",
"a",
"PermFlag",
"from",
"permissions",
"strings",
"and",
"setting",
"them",
"all"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/util.go#L58-L67 | train |
hyperledger/burrow | permission/util.go | PermFlagFromStringList | func PermFlagFromStringList(permissions []string) (PermFlag, error) {
var permFlag PermFlag
for _, perm := range permissions {
s := strings.TrimSpace(perm)
if s == "" {
continue
}
flag, err := PermStringToFlag(s)
if err != nil {
return permFlag, err
}
permFlag |= flag
}
return permFlag, nil
} | go | func PermFlagFromStringList(permissions []string) (PermFlag, error) {
var permFlag PermFlag
for _, perm := range permissions {
s := strings.TrimSpace(perm)
if s == "" {
continue
}
flag, err := PermStringToFlag(s)
if err != nil {
return permFlag, err
}
permFlag |= flag
}
return permFlag, nil
} | [
"func",
"PermFlagFromStringList",
"(",
"permissions",
"[",
"]",
"string",
")",
"(",
"PermFlag",
",",
"error",
")",
"{",
"var",
"permFlag",
"PermFlag",
"\n",
"for",
"_",
",",
"perm",
":=",
"range",
"permissions",
"{",
"s",
":=",
"strings",
".",
"TrimSpace",... | // Builds a composite PermFlag by mapping each permission string in permissions to its
// flag and composing them with binary or | [
"Builds",
"a",
"composite",
"PermFlag",
"by",
"mapping",
"each",
"permission",
"string",
"in",
"permissions",
"to",
"its",
"flag",
"and",
"composing",
"them",
"with",
"binary",
"or"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/util.go#L71-L85 | train |
hyperledger/burrow | permission/util.go | PermFlagToStringList | func PermFlagToStringList(permFlag PermFlag) []string {
permStrings := make([]string, 0, NumPermissions)
for i := uint(0); i < NumPermissions; i++ {
permFlag := permFlag & (1 << i)
if permFlag > 0 {
permStrings = append(permStrings, permFlag.String())
}
}
return permStrings
} | go | func PermFlagToStringList(permFlag PermFlag) []string {
permStrings := make([]string, 0, NumPermissions)
for i := uint(0); i < NumPermissions; i++ {
permFlag := permFlag & (1 << i)
if permFlag > 0 {
permStrings = append(permStrings, permFlag.String())
}
}
return permStrings
} | [
"func",
"PermFlagToStringList",
"(",
"permFlag",
"PermFlag",
")",
"[",
"]",
"string",
"{",
"permStrings",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"NumPermissions",
")",
"\n",
"for",
"i",
":=",
"uint",
"(",
"0",
")",
";",
"i",
"<",
"NumP... | // Creates a list of individual permission flag strings from a possibly composite PermFlag
// by projecting out each bit and adding its permission string if it is set | [
"Creates",
"a",
"list",
"of",
"individual",
"permission",
"flag",
"strings",
"from",
"a",
"possibly",
"composite",
"PermFlag",
"by",
"projecting",
"out",
"each",
"bit",
"and",
"adding",
"its",
"permission",
"string",
"if",
"it",
"is",
"set"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/permission/util.go#L95-L104 | train |
hyperledger/burrow | rpc/service.go | NewService | func NewService(state acmstate.IterableStatsReader, nameReg names.IterableReader, blockchain bcm.BlockchainInfo,
validators validator.History, nodeView *tendermint.NodeView, logger *logging.Logger) *Service {
return &Service{
state: state,
nameReg: nameReg,
blockchain: blockchain,
validators: validat... | go | func NewService(state acmstate.IterableStatsReader, nameReg names.IterableReader, blockchain bcm.BlockchainInfo,
validators validator.History, nodeView *tendermint.NodeView, logger *logging.Logger) *Service {
return &Service{
state: state,
nameReg: nameReg,
blockchain: blockchain,
validators: validat... | [
"func",
"NewService",
"(",
"state",
"acmstate",
".",
"IterableStatsReader",
",",
"nameReg",
"names",
".",
"IterableReader",
",",
"blockchain",
"bcm",
".",
"BlockchainInfo",
",",
"validators",
"validator",
".",
"History",
",",
"nodeView",
"*",
"tendermint",
".",
... | // Service provides an internal query and information service with serialisable return types on which can accomodate
// a number of transport front ends | [
"Service",
"provides",
"an",
"internal",
"query",
"and",
"information",
"service",
"with",
"serialisable",
"return",
"types",
"on",
"which",
"can",
"accomodate",
"a",
"number",
"of",
"transport",
"front",
"ends"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/service.go#L58-L69 | train |
hyperledger/burrow | rpc/service.go | Blocks | func (s *Service) Blocks(minHeight, maxHeight int64) (*ResultBlocks, error) {
if s.nodeView == nil {
return nil, fmt.Errorf("NodeView is not mounted so cannot pull Tendermint blocks")
}
latestHeight := int64(s.blockchain.LastBlockHeight())
if minHeight < 1 {
minHeight = latestHeight
}
if maxHeight == 0 || la... | go | func (s *Service) Blocks(minHeight, maxHeight int64) (*ResultBlocks, error) {
if s.nodeView == nil {
return nil, fmt.Errorf("NodeView is not mounted so cannot pull Tendermint blocks")
}
latestHeight := int64(s.blockchain.LastBlockHeight())
if minHeight < 1 {
minHeight = latestHeight
}
if maxHeight == 0 || la... | [
"func",
"(",
"s",
"*",
"Service",
")",
"Blocks",
"(",
"minHeight",
",",
"maxHeight",
"int64",
")",
"(",
"*",
"ResultBlocks",
",",
"error",
")",
"{",
"if",
"s",
".",
"nodeView",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\""... | // Returns the current blockchain height and metadata for a range of blocks
// between minHeight and maxHeight. Only returns maxBlockLookback block metadata
// from the top of the range of blocks.
// Passing 0 for maxHeight sets the upper height of the range to the current
// blockchain height. | [
"Returns",
"the",
"current",
"blockchain",
"height",
"and",
"metadata",
"for",
"a",
"range",
"of",
"blocks",
"between",
"minHeight",
"and",
"maxHeight",
".",
"Only",
"returns",
"maxBlockLookback",
"block",
"metadata",
"from",
"the",
"top",
"of",
"the",
"range",
... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/rpc/service.go#L298-L324 | train |
hyperledger/burrow | genesis/deterministic_genesis.go | NewDeterministicGenesis | func NewDeterministicGenesis(seed int64) *deterministicGenesis {
return &deterministicGenesis{
random: rand.New(rand.NewSource(seed)),
}
} | go | func NewDeterministicGenesis(seed int64) *deterministicGenesis {
return &deterministicGenesis{
random: rand.New(rand.NewSource(seed)),
}
} | [
"func",
"NewDeterministicGenesis",
"(",
"seed",
"int64",
")",
"*",
"deterministicGenesis",
"{",
"return",
"&",
"deterministicGenesis",
"{",
"random",
":",
"rand",
".",
"New",
"(",
"rand",
".",
"NewSource",
"(",
"seed",
")",
")",
",",
"}",
"\n",
"}"
] | // Generates deterministic pseudo-random genesis state | [
"Generates",
"deterministic",
"pseudo",
"-",
"random",
"genesis",
"state"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/genesis/deterministic_genesis.go#L18-L22 | train |
hyperledger/burrow | execution/contexts/governance_context.go | Execute | func (ctx *GovernanceContext) Execute(txe *exec.TxExecution, p payload.Payload) error {
var ok bool
ctx.txe = txe
ctx.tx, ok = p.(*payload.GovTx)
if !ok {
return fmt.Errorf("payload must be NameTx, but is: %v", txe.Envelope.Tx.Payload)
}
// Nothing down with any incoming funds at this point
accounts, _, err :=... | go | func (ctx *GovernanceContext) Execute(txe *exec.TxExecution, p payload.Payload) error {
var ok bool
ctx.txe = txe
ctx.tx, ok = p.(*payload.GovTx)
if !ok {
return fmt.Errorf("payload must be NameTx, but is: %v", txe.Envelope.Tx.Payload)
}
// Nothing down with any incoming funds at this point
accounts, _, err :=... | [
"func",
"(",
"ctx",
"*",
"GovernanceContext",
")",
"Execute",
"(",
"txe",
"*",
"exec",
".",
"TxExecution",
",",
"p",
"payload",
".",
"Payload",
")",
"error",
"{",
"var",
"ok",
"bool",
"\n",
"ctx",
".",
"txe",
"=",
"txe",
"\n",
"ctx",
".",
"tx",
","... | // GovTx provides a set of TemplateAccounts and GovernanceContext tries to alter the chain state to match the
// specification given | [
"GovTx",
"provides",
"a",
"set",
"of",
"TemplateAccounts",
"and",
"GovernanceContext",
"tries",
"to",
"alter",
"the",
"chain",
"state",
"to",
"match",
"the",
"specification",
"given"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/contexts/governance_context.go#L29-L88 | train |
hyperledger/burrow | vent/sqldb/utils.go | findTable | func (db *SQLDB) findTable(tableName string) (bool, error) {
found := 0
safeTable := safe(tableName)
query := db.DBAdapter.FindTableQuery()
db.Log.Info("msg", "FIND TABLE", "query", query, "value", safeTable)
if err := db.DB.QueryRow(query, tableName).Scan(&found); err != nil {
db.Log.Info("msg", "Error findin... | go | func (db *SQLDB) findTable(tableName string) (bool, error) {
found := 0
safeTable := safe(tableName)
query := db.DBAdapter.FindTableQuery()
db.Log.Info("msg", "FIND TABLE", "query", query, "value", safeTable)
if err := db.DB.QueryRow(query, tableName).Scan(&found); err != nil {
db.Log.Info("msg", "Error findin... | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"findTable",
"(",
"tableName",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"found",
":=",
"0",
"\n",
"safeTable",
":=",
"safe",
"(",
"tableName",
")",
"\n",
"query",
":=",
"db",
".",
"DBAdapter",
".",
"... | // findTable checks if a table exists in the default schema | [
"findTable",
"checks",
"if",
"a",
"table",
"exists",
"in",
"the",
"default",
"schema"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L19-L37 | train |
hyperledger/burrow | vent/sqldb/utils.go | getTableDef | func (db *SQLDB) getTableDef(tableName string) (*types.SQLTable, error) {
table := &types.SQLTable{
Name: safe(tableName),
}
found, err := db.findTable(table.Name)
if err != nil {
return nil, err
}
if !found {
db.Log.Info("msg", "Error table not found", "value", table.Name)
return nil, errors.New("Error ... | go | func (db *SQLDB) getTableDef(tableName string) (*types.SQLTable, error) {
table := &types.SQLTable{
Name: safe(tableName),
}
found, err := db.findTable(table.Name)
if err != nil {
return nil, err
}
if !found {
db.Log.Info("msg", "Error table not found", "value", table.Name)
return nil, errors.New("Error ... | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"getTableDef",
"(",
"tableName",
"string",
")",
"(",
"*",
"types",
".",
"SQLTable",
",",
"error",
")",
"{",
"table",
":=",
"&",
"types",
".",
"SQLTable",
"{",
"Name",
":",
"safe",
"(",
"tableName",
")",
",",
"}... | // getTableDef returns the structure of a given SQL table | [
"getTableDef",
"returns",
"the",
"structure",
"of",
"a",
"given",
"SQL",
"table"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L176-L232 | train |
hyperledger/burrow | vent/sqldb/utils.go | alterTable | func (db *SQLDB) alterTable(table *types.SQLTable) error {
db.Log.Info("msg", "Altering table", "value", table.Name)
// prepare log query
logQuery := db.DBAdapter.InsertLogQuery()
// current table structure
safeTable := safe(table.Name)
currentTable, err := db.getTableDef(safeTable)
if err != nil {
return er... | go | func (db *SQLDB) alterTable(table *types.SQLTable) error {
db.Log.Info("msg", "Altering table", "value", table.Name)
// prepare log query
logQuery := db.DBAdapter.InsertLogQuery()
// current table structure
safeTable := safe(table.Name)
currentTable, err := db.getTableDef(safeTable)
if err != nil {
return er... | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"alterTable",
"(",
"table",
"*",
"types",
".",
"SQLTable",
")",
"error",
"{",
"db",
".",
"Log",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"table",
".",
"Name",
")",
"\n\n",
"// pr... | // alterTable alters the structure of a SQL table & add info to the dictionary | [
"alterTable",
"alters",
"the",
"structure",
"of",
"a",
"SQL",
"table",
"&",
"add",
"info",
"to",
"the",
"dictionary"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L235-L311 | train |
hyperledger/burrow | vent/sqldb/utils.go | createTable | func (db *SQLDB) createTable(table *types.SQLTable, isInitialise bool) error {
db.Log.Info("msg", "Creating Table", "value", table.Name)
// prepare log query
logQuery := db.DBAdapter.InsertLogQuery()
//get create table query
safeTable := safe(table.Name)
query, dictionary := db.DBAdapter.CreateTableQuery(safeTa... | go | func (db *SQLDB) createTable(table *types.SQLTable, isInitialise bool) error {
db.Log.Info("msg", "Creating Table", "value", table.Name)
// prepare log query
logQuery := db.DBAdapter.InsertLogQuery()
//get create table query
safeTable := safe(table.Name)
query, dictionary := db.DBAdapter.CreateTableQuery(safeTa... | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"createTable",
"(",
"table",
"*",
"types",
".",
"SQLTable",
",",
"isInitialise",
"bool",
")",
"error",
"{",
"db",
".",
"Log",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"table",
".",... | // createTable creates a new table | [
"createTable",
"creates",
"a",
"new",
"table"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L314-L368 | train |
hyperledger/burrow | vent/sqldb/utils.go | getSelectQuery | func (db *SQLDB) getSelectQuery(table *types.SQLTable, height uint64) (string, error) {
fields := ""
for _, tableColumn := range table.Columns {
if fields != "" {
fields += ", "
}
fields += db.DBAdapter.SecureName(tableColumn.Name)
}
if fields == "" {
return "", errors.New("error table does not contai... | go | func (db *SQLDB) getSelectQuery(table *types.SQLTable, height uint64) (string, error) {
fields := ""
for _, tableColumn := range table.Columns {
if fields != "" {
fields += ", "
}
fields += db.DBAdapter.SecureName(tableColumn.Name)
}
if fields == "" {
return "", errors.New("error table does not contai... | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"getSelectQuery",
"(",
"table",
"*",
"types",
".",
"SQLTable",
",",
"height",
"uint64",
")",
"(",
"string",
",",
"error",
")",
"{",
"fields",
":=",
"\"",
"\"",
"\n\n",
"for",
"_",
",",
"tableColumn",
":=",
"range... | // getSelectQuery builds a select query for a specific SQL table and a given block | [
"getSelectQuery",
"builds",
"a",
"select",
"query",
"for",
"a",
"specific",
"SQL",
"table",
"and",
"a",
"given",
"block"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L398-L415 | train |
hyperledger/burrow | vent/sqldb/utils.go | getBlockTables | func (db *SQLDB) getBlockTables(height uint64) (types.EventTables, error) {
tables := make(types.EventTables)
query := db.DBAdapter.SelectLogQuery()
db.Log.Info("msg", "QUERY LOG", "query", query, "value", height)
rows, err := db.DB.Query(query, height)
if err != nil {
db.Log.Info("msg", "Error querying log", ... | go | func (db *SQLDB) getBlockTables(height uint64) (types.EventTables, error) {
tables := make(types.EventTables)
query := db.DBAdapter.SelectLogQuery()
db.Log.Info("msg", "QUERY LOG", "query", query, "value", height)
rows, err := db.DB.Query(query, height)
if err != nil {
db.Log.Info("msg", "Error querying log", ... | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"getBlockTables",
"(",
"height",
"uint64",
")",
"(",
"types",
".",
"EventTables",
",",
"error",
")",
"{",
"tables",
":=",
"make",
"(",
"types",
".",
"EventTables",
")",
"\n\n",
"query",
":=",
"db",
".",
"DBAdapter"... | // getBlockTables return all SQL tables that have been involved
// in a given batch transaction for a specific block | [
"getBlockTables",
"return",
"all",
"SQL",
"tables",
"that",
"have",
"been",
"involved",
"in",
"a",
"given",
"batch",
"transaction",
"for",
"a",
"specific",
"block"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L419-L457 | train |
hyperledger/burrow | vent/sqldb/utils.go | safe | func safe(parameter string) string {
replacer := strings.NewReplacer(";", "", ",", "")
return replacer.Replace(parameter)
} | go | func safe(parameter string) string {
replacer := strings.NewReplacer(";", "", ",", "")
return replacer.Replace(parameter)
} | [
"func",
"safe",
"(",
"parameter",
"string",
")",
"string",
"{",
"replacer",
":=",
"strings",
".",
"NewReplacer",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"replacer",
".",
"Replace",
"(",
"parameter",
")... | // safe sanitizes a parameter | [
"safe",
"sanitizes",
"a",
"parameter"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L460-L463 | train |
hyperledger/burrow | vent/sqldb/utils.go | getJSON | func (db *SQLDB) getJSON(JSON interface{}) ([]byte, error) {
if JSON != nil {
return json.Marshal(JSON)
}
return json.Marshal("")
} | go | func (db *SQLDB) getJSON(JSON interface{}) ([]byte, error) {
if JSON != nil {
return json.Marshal(JSON)
}
return json.Marshal("")
} | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"getJSON",
"(",
"JSON",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"JSON",
"!=",
"nil",
"{",
"return",
"json",
".",
"Marshal",
"(",
"JSON",
")",
"\n",
"}",
"\n",
"retur... | //getJSON returns marshaled json from JSON single column | [
"getJSON",
"returns",
"marshaled",
"json",
"from",
"JSON",
"single",
"column"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L466-L471 | train |
hyperledger/burrow | vent/sqldb/utils.go | getJSONFromValues | func (db *SQLDB) getJSONFromValues(values []interface{}) ([]byte, error) {
if values != nil {
return json.Marshal(values)
}
return json.Marshal("")
} | go | func (db *SQLDB) getJSONFromValues(values []interface{}) ([]byte, error) {
if values != nil {
return json.Marshal(values)
}
return json.Marshal("")
} | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"getJSONFromValues",
"(",
"values",
"[",
"]",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"values",
"!=",
"nil",
"{",
"return",
"json",
".",
"Marshal",
"(",
"values",
")",
... | //getJSONFromValues returns marshaled json from query values | [
"getJSONFromValues",
"returns",
"marshaled",
"json",
"from",
"query",
"values"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L474-L479 | train |
hyperledger/burrow | vent/sqldb/utils.go | getValuesFromJSON | func (db *SQLDB) getValuesFromJSON(JSON string) ([]interface{}, error) {
pointers := make([]interface{}, 0)
bytes := []byte(JSON)
err := json.Unmarshal(bytes, &pointers)
return pointers, err
} | go | func (db *SQLDB) getValuesFromJSON(JSON string) ([]interface{}, error) {
pointers := make([]interface{}, 0)
bytes := []byte(JSON)
err := json.Unmarshal(bytes, &pointers)
return pointers, err
} | [
"func",
"(",
"db",
"*",
"SQLDB",
")",
"getValuesFromJSON",
"(",
"JSON",
"string",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"pointers",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"0",
")",
"\n",
"bytes",
":=... | //getValuesFromJSON returns query values from unmarshaled JSON column | [
"getValuesFromJSON",
"returns",
"query",
"values",
"from",
"unmarshaled",
"JSON",
"column"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/sqldb/utils.go#L482-L487 | train |
hyperledger/burrow | execution/errors/errors.go | AsException | func AsException(err error) *Exception {
if err == nil {
return nil
}
switch e := err.(type) {
case *Exception:
return e
case CodedError:
return NewException(e.ErrorCode(), e.String())
default:
return NewException(ErrorCodeGeneric, err.Error())
}
} | go | func AsException(err error) *Exception {
if err == nil {
return nil
}
switch e := err.(type) {
case *Exception:
return e
case CodedError:
return NewException(e.ErrorCode(), e.String())
default:
return NewException(ErrorCodeGeneric, err.Error())
}
} | [
"func",
"AsException",
"(",
"err",
"error",
")",
"*",
"Exception",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"switch",
"e",
":=",
"err",
".",
"(",
"type",
")",
"{",
"case",
"*",
"Exception",
":",
"return",
"e",
"\n",
"... | // Wraps any error as a Exception | [
"Wraps",
"any",
"error",
"as",
"a",
"Exception"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/execution/errors/errors.go#L171-L183 | train |
hyperledger/burrow | crypto/private_key.go | PublicKeyFromBytes | func PublicKeyFromBytes(bs []byte, curveType CurveType) (PublicKey, error) {
switch curveType {
case CurveTypeEd25519:
if len(bs) != ed25519.PublicKeySize {
return PublicKey{}, fmt.Errorf("bytes passed have length %v but ed25519 public keys have %v bytes",
len(bs), ed25519.PublicKeySize)
}
case CurveTypeS... | go | func PublicKeyFromBytes(bs []byte, curveType CurveType) (PublicKey, error) {
switch curveType {
case CurveTypeEd25519:
if len(bs) != ed25519.PublicKeySize {
return PublicKey{}, fmt.Errorf("bytes passed have length %v but ed25519 public keys have %v bytes",
len(bs), ed25519.PublicKeySize)
}
case CurveTypeS... | [
"func",
"PublicKeyFromBytes",
"(",
"bs",
"[",
"]",
"byte",
",",
"curveType",
"CurveType",
")",
"(",
"PublicKey",
",",
"error",
")",
"{",
"switch",
"curveType",
"{",
"case",
"CurveTypeEd25519",
":",
"if",
"len",
"(",
"bs",
")",
"!=",
"ed25519",
".",
"Publ... | // Currently this is a stub that reads the raw bytes returned by key_client and returns
// an ed25519 public key. | [
"Currently",
"this",
"is",
"a",
"stub",
"that",
"reads",
"the",
"raw",
"bytes",
"returned",
"by",
"key_client",
"and",
"returns",
"an",
"ed25519",
"public",
"key",
"."
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/crypto/private_key.go#L16-L38 | train |
hyperledger/burrow | crypto/private_key.go | Reinitialise | func (p *PrivateKey) Reinitialise() error {
initP, err := PrivateKeyFromRawBytes(p.RawBytes(), p.CurveType)
if err != nil {
return err
}
*p = initP
return nil
} | go | func (p *PrivateKey) Reinitialise() error {
initP, err := PrivateKeyFromRawBytes(p.RawBytes(), p.CurveType)
if err != nil {
return err
}
*p = initP
return nil
} | [
"func",
"(",
"p",
"*",
"PrivateKey",
")",
"Reinitialise",
"(",
")",
"error",
"{",
"initP",
",",
"err",
":=",
"PrivateKeyFromRawBytes",
"(",
"p",
".",
"RawBytes",
"(",
")",
",",
"p",
".",
"CurveType",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return"... | // Reinitialise after serialisation | [
"Reinitialise",
"after",
"serialisation"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/crypto/private_key.go#L74-L81 | train |
hyperledger/burrow | crypto/private_key.go | EnsureEd25519PrivateKeyCorrect | func EnsureEd25519PrivateKeyCorrect(candidatePrivateKey ed25519.PrivateKey) error {
if len(candidatePrivateKey) != ed25519.PrivateKeySize {
return fmt.Errorf("ed25519 key has size %v but %v bytes passed as key", ed25519.PrivateKeySize,
len(candidatePrivateKey))
}
_, derivedPrivateKey, err := ed25519.GenerateKey... | go | func EnsureEd25519PrivateKeyCorrect(candidatePrivateKey ed25519.PrivateKey) error {
if len(candidatePrivateKey) != ed25519.PrivateKeySize {
return fmt.Errorf("ed25519 key has size %v but %v bytes passed as key", ed25519.PrivateKeySize,
len(candidatePrivateKey))
}
_, derivedPrivateKey, err := ed25519.GenerateKey... | [
"func",
"EnsureEd25519PrivateKeyCorrect",
"(",
"candidatePrivateKey",
"ed25519",
".",
"PrivateKey",
")",
"error",
"{",
"if",
"len",
"(",
"candidatePrivateKey",
")",
"!=",
"ed25519",
".",
"PrivateKeySize",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
","... | // Ensures the last 32 bytes of the ed25519 private key is the public key derived from the first 32 private bytes | [
"Ensures",
"the",
"last",
"32",
"bytes",
"of",
"the",
"ed25519",
"private",
"key",
"is",
"the",
"public",
"key",
"derived",
"from",
"the",
"first",
"32",
"private",
"bytes"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/crypto/private_key.go#L142-L156 | train |
hyperledger/burrow | storage/content_addressed_store.go | Put | func (cas *ContentAddressedStore) Put(data []byte) ([]byte, error) {
hasher := sha256.New()
_, err := hasher.Write(data)
if err != nil {
return nil, fmt.Errorf("ContentAddressedStore could not hash data: %v", err)
}
hash := hasher.Sum(nil)
cas.db.SetSync(hash, data)
return hash, nil
} | go | func (cas *ContentAddressedStore) Put(data []byte) ([]byte, error) {
hasher := sha256.New()
_, err := hasher.Write(data)
if err != nil {
return nil, fmt.Errorf("ContentAddressedStore could not hash data: %v", err)
}
hash := hasher.Sum(nil)
cas.db.SetSync(hash, data)
return hash, nil
} | [
"func",
"(",
"cas",
"*",
"ContentAddressedStore",
")",
"Put",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"hasher",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"_",
",",
"err",
":=",
"hasher",
".",
"Write",
... | // These function match those used in Hoard
// Put data in the database by saving data with a key that is its sha256 hash | [
"These",
"function",
"match",
"those",
"used",
"in",
"Hoard",
"Put",
"data",
"in",
"the",
"database",
"by",
"saving",
"data",
"with",
"a",
"key",
"that",
"is",
"its",
"sha256",
"hash"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/storage/content_addressed_store.go#L24-L33 | train |
hyperledger/burrow | logging/logconfig/presets/instructions.go | push | func push(stack []*logconfig.SinkConfig, sinkConfigs ...*logconfig.SinkConfig) []*logconfig.SinkConfig {
for _, sinkConfig := range sinkConfigs {
peek(stack).AddSinks(sinkConfig)
stack = append(stack, sinkConfig)
}
return stack
} | go | func push(stack []*logconfig.SinkConfig, sinkConfigs ...*logconfig.SinkConfig) []*logconfig.SinkConfig {
for _, sinkConfig := range sinkConfigs {
peek(stack).AddSinks(sinkConfig)
stack = append(stack, sinkConfig)
}
return stack
} | [
"func",
"push",
"(",
"stack",
"[",
"]",
"*",
"logconfig",
".",
"SinkConfig",
",",
"sinkConfigs",
"...",
"*",
"logconfig",
".",
"SinkConfig",
")",
"[",
"]",
"*",
"logconfig",
".",
"SinkConfig",
"{",
"for",
"_",
",",
"sinkConfig",
":=",
"range",
"sinkConfi... | // Push a path sequence of sinks onto the stack | [
"Push",
"a",
"path",
"sequence",
"of",
"sinks",
"onto",
"the",
"stack"
] | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/logging/logconfig/presets/instructions.go#L266-L272 | train |
hyperledger/burrow | vent/service/consumer.go | NewConsumer | func NewConsumer(cfg *config.VentConfig, log *logger.Logger, eventChannel chan types.EventData) *Consumer {
return &Consumer{
Config: cfg,
Log: log,
Closing: false,
EventsChannel: eventChannel,
}
} | go | func NewConsumer(cfg *config.VentConfig, log *logger.Logger, eventChannel chan types.EventData) *Consumer {
return &Consumer{
Config: cfg,
Log: log,
Closing: false,
EventsChannel: eventChannel,
}
} | [
"func",
"NewConsumer",
"(",
"cfg",
"*",
"config",
".",
"VentConfig",
",",
"log",
"*",
"logger",
".",
"Logger",
",",
"eventChannel",
"chan",
"types",
".",
"EventData",
")",
"*",
"Consumer",
"{",
"return",
"&",
"Consumer",
"{",
"Config",
":",
"cfg",
",",
... | // NewConsumer constructs a new consumer configuration.
// The event channel will be passed a collection of rows generated from all of the events in a single block
// It will be closed by the consumer when it is finished | [
"NewConsumer",
"constructs",
"a",
"new",
"consumer",
"configuration",
".",
"The",
"event",
"channel",
"will",
"be",
"passed",
"a",
"collection",
"of",
"rows",
"generated",
"from",
"all",
"of",
"the",
"events",
"in",
"a",
"single",
"block",
"It",
"will",
"be"... | 59993f5aad71a8e16ab6ed4e57e138e2398eae4e | https://github.com/hyperledger/burrow/blob/59993f5aad71a8e16ab6ed4e57e138e2398eae4e/vent/service/consumer.go#L47-L54 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.