id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
30,000
hyperledger/fabric-sdk-go
pkg/fab/orderer/orderer.go
wrapStreamStatusRPC
func wrapStreamStatusRPC(responses chan common.Status, errs chan error) (*common.Status, error) { var status common.Status var err multi.Errors read: for { select { case s, ok := <-responses: if !ok { break read } status = s case e := <-errs: err = append(err, e) } } // drain remaining er...
go
func wrapStreamStatusRPC(responses chan common.Status, errs chan error) (*common.Status, error) { var status common.Status var err multi.Errors read: for { select { case s, ok := <-responses: if !ok { break read } status = s case e := <-errs: err = append(err, e) } } // drain remaining er...
[ "func", "wrapStreamStatusRPC", "(", "responses", "chan", "common", ".", "Status", ",", "errs", "chan", "error", ")", "(", "*", "common", ".", "Status", ",", "error", ")", "{", "var", "status", "common", ".", "Status", "\n", "var", "err", "multi", ".", ...
// wrapStreamStatusRPC returns the last response and err and blocks until the chan is closed.
[ "wrapStreamStatusRPC", "returns", "the", "last", "response", "and", "err", "and", "blocks", "until", "the", "chan", "is", "closed", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/orderer/orderer.go#L287-L311
30,001
hyperledger/fabric-sdk-go
pkg/fab/events/client/mocks/numevents.go
NewReceived
func NewReceived(numBlock NumBlock, numChaincode NumChaincode) Received { return Received{NumBlock: numBlock, NumChaincode: numChaincode} }
go
func NewReceived(numBlock NumBlock, numChaincode NumChaincode) Received { return Received{NumBlock: numBlock, NumChaincode: numChaincode} }
[ "func", "NewReceived", "(", "numBlock", "NumBlock", ",", "numChaincode", "NumChaincode", ")", "Received", "{", "return", "Received", "{", "NumBlock", ":", "numBlock", ",", "NumChaincode", ":", "numChaincode", "}", "\n", "}" ]
// NewReceived returns a new Received struct
[ "NewReceived", "returns", "a", "new", "Received", "struct" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/mocks/numevents.go#L48-L50
30,002
hyperledger/fabric-sdk-go
pkg/fab/channel/ledger.go
NewLedger
func NewLedger(chName string) (*Ledger, error) { l := Ledger{ chName: chName, } return &l, nil }
go
func NewLedger(chName string) (*Ledger, error) { l := Ledger{ chName: chName, } return &l, nil }
[ "func", "NewLedger", "(", "chName", "string", ")", "(", "*", "Ledger", ",", "error", ")", "{", "l", ":=", "Ledger", "{", "chName", ":", "chName", ",", "}", "\n", "return", "&", "l", ",", "nil", "\n", "}" ]
// NewLedger constructs a Ledger client for the current context and named channel.
[ "NewLedger", "constructs", "a", "Ledger", "client", "for", "the", "current", "context", "and", "named", "channel", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L45-L50
30,003
hyperledger/fabric-sdk-go
pkg/fab/channel/ledger.go
QueryBlockByHash
func (c *Ledger) QueryBlockByHash(reqCtx reqContext.Context, blockHash []byte, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error) { if len(blockHash) == 0 { return nil, errors.New("blockHash is required") } cir := createBlockByHashInvokeRequest(c.chName, blockHash) tprs, errs :...
go
func (c *Ledger) QueryBlockByHash(reqCtx reqContext.Context, blockHash []byte, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error) { if len(blockHash) == 0 { return nil, errors.New("blockHash is required") } cir := createBlockByHashInvokeRequest(c.chName, blockHash) tprs, errs :...
[ "func", "(", "c", "*", "Ledger", ")", "QueryBlockByHash", "(", "reqCtx", "reqContext", ".", "Context", ",", "blockHash", "[", "]", "byte", ",", "targets", "[", "]", "fab", ".", "ProposalProcessor", ",", "verifier", "ResponseVerifier", ")", "(", "[", "]", ...
// QueryBlockByHash queries the ledger for Block by block hash. // This query will be made to specified targets. // Returns the block.
[ "QueryBlockByHash", "queries", "the", "ledger", "for", "Block", "by", "block", "hash", ".", "This", "query", "will", "be", "made", "to", "specified", "targets", ".", "Returns", "the", "block", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L84-L97
30,004
hyperledger/fabric-sdk-go
pkg/fab/channel/ledger.go
QueryBlockByTxID
func (c *Ledger) QueryBlockByTxID(reqCtx reqContext.Context, txID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error) { if txID == "" { return nil, errors.New("txID is required") } cir := createBlockByTxIDInvokeRequest(c.chName, txID) tprs, errs := queryChainc...
go
func (c *Ledger) QueryBlockByTxID(reqCtx reqContext.Context, txID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.Block, error) { if txID == "" { return nil, errors.New("txID is required") } cir := createBlockByTxIDInvokeRequest(c.chName, txID) tprs, errs := queryChainc...
[ "func", "(", "c", "*", "Ledger", ")", "QueryBlockByTxID", "(", "reqCtx", "reqContext", ".", "Context", ",", "txID", "fab", ".", "TransactionID", ",", "targets", "[", "]", "fab", ".", "ProposalProcessor", ",", "verifier", "ResponseVerifier", ")", "(", "[", ...
// QueryBlockByTxID returns a block which contains a transaction // This query will be made to specified targets. // Returns the block.
[ "QueryBlockByTxID", "returns", "a", "block", "which", "contains", "a", "transaction", "This", "query", "will", "be", "made", "to", "specified", "targets", ".", "Returns", "the", "block", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L102-L115
30,005
hyperledger/fabric-sdk-go
pkg/fab/channel/ledger.go
QueryTransaction
func (c *Ledger) QueryTransaction(reqCtx reqContext.Context, transactionID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ProcessedTransaction, error) { cir := createTransactionByIDInvokeRequest(c.chName, transactionID) tprs, errs := queryChaincode(reqCtx, c.chName, cir, target...
go
func (c *Ledger) QueryTransaction(reqCtx reqContext.Context, transactionID fab.TransactionID, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ProcessedTransaction, error) { cir := createTransactionByIDInvokeRequest(c.chName, transactionID) tprs, errs := queryChaincode(reqCtx, c.chName, cir, target...
[ "func", "(", "c", "*", "Ledger", ")", "QueryTransaction", "(", "reqCtx", "reqContext", ".", "Context", ",", "transactionID", "fab", ".", "TransactionID", ",", "targets", "[", "]", "fab", ".", "ProposalProcessor", ",", "verifier", "ResponseVerifier", ")", "(", ...
// QueryTransaction queries the ledger for Transaction by number. // This query will be made to specified targets. // Returns the ProcessedTransaction information containing the transaction.
[ "QueryTransaction", "queries", "the", "ledger", "for", "Transaction", "by", "number", ".", "This", "query", "will", "be", "made", "to", "specified", "targets", ".", "Returns", "the", "ProcessedTransaction", "information", "containing", "the", "transaction", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L157-L173
30,006
hyperledger/fabric-sdk-go
pkg/fab/channel/ledger.go
QueryInstantiatedChaincodes
func (c *Ledger) QueryInstantiatedChaincodes(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ChaincodeQueryResponse, error) { cir := createChaincodeInvokeRequest() tprs, errs := queryChaincode(reqCtx, c.chName, cir, targets, verifier) responses := []*pb.ChaincodeQueryRe...
go
func (c *Ledger) QueryInstantiatedChaincodes(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*pb.ChaincodeQueryResponse, error) { cir := createChaincodeInvokeRequest() tprs, errs := queryChaincode(reqCtx, c.chName, cir, targets, verifier) responses := []*pb.ChaincodeQueryRe...
[ "func", "(", "c", "*", "Ledger", ")", "QueryInstantiatedChaincodes", "(", "reqCtx", "reqContext", ".", "Context", ",", "targets", "[", "]", "fab", ".", "ProposalProcessor", ",", "verifier", "ResponseVerifier", ")", "(", "[", "]", "*", "pb", ".", "ChaincodeQu...
// QueryInstantiatedChaincodes queries the instantiated chaincodes on this channel. // This query will be made to specified targets.
[ "QueryInstantiatedChaincodes", "queries", "the", "instantiated", "chaincodes", "on", "this", "channel", ".", "This", "query", "will", "be", "made", "to", "specified", "targets", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L186-L200
30,007
hyperledger/fabric-sdk-go
pkg/fab/channel/ledger.go
QueryCollectionsConfig
func (c *Ledger) QueryCollectionsConfig(reqCtx reqContext.Context, chaincodeName string, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.CollectionConfigPackage, error) { cir := createCollectionsConfigInvokeRequest(chaincodeName) tprs, errs := queryChaincode(reqCtx, c.chName, cir, targets, veri...
go
func (c *Ledger) QueryCollectionsConfig(reqCtx reqContext.Context, chaincodeName string, targets []fab.ProposalProcessor, verifier ResponseVerifier) ([]*common.CollectionConfigPackage, error) { cir := createCollectionsConfigInvokeRequest(chaincodeName) tprs, errs := queryChaincode(reqCtx, c.chName, cir, targets, veri...
[ "func", "(", "c", "*", "Ledger", ")", "QueryCollectionsConfig", "(", "reqCtx", "reqContext", ".", "Context", ",", "chaincodeName", "string", ",", "targets", "[", "]", "fab", ".", "ProposalProcessor", ",", "verifier", "ResponseVerifier", ")", "(", "[", "]", "...
// QueryCollectionsConfig queries the collections config for a chaincode on this channel.
[ "QueryCollectionsConfig", "queries", "the", "collections", "config", "for", "a", "chaincode", "on", "this", "channel", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L212-L226
30,008
hyperledger/fabric-sdk-go
pkg/fab/channel/ledger.go
QueryConfigBlock
func (c *Ledger) QueryConfigBlock(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) (*common.Block, error) { if len(targets) == 0 { return nil, errors.New("target(s) required") } cir := createConfigBlockInvokeRequest(c.chName) tprs, err := queryChaincode(reqCtx, c.chName, cir...
go
func (c *Ledger) QueryConfigBlock(reqCtx reqContext.Context, targets []fab.ProposalProcessor, verifier ResponseVerifier) (*common.Block, error) { if len(targets) == 0 { return nil, errors.New("target(s) required") } cir := createConfigBlockInvokeRequest(c.chName) tprs, err := queryChaincode(reqCtx, c.chName, cir...
[ "func", "(", "c", "*", "Ledger", ")", "QueryConfigBlock", "(", "reqCtx", "reqContext", ".", "Context", ",", "targets", "[", "]", "fab", ".", "ProposalProcessor", ",", "verifier", "ResponseVerifier", ")", "(", "*", "common", ".", "Block", ",", "error", ")",...
// QueryConfigBlock returns the current configuration block for the specified channel. If the // peer doesn't belong to the channel, return error
[ "QueryConfigBlock", "returns", "the", "current", "configuration", "block", "for", "the", "specified", "channel", ".", "If", "the", "peer", "doesn", "t", "belong", "to", "the", "channel", "return", "error" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L239-L256
30,009
hyperledger/fabric-sdk-go
pkg/client/event/opts.go
WithBlockNum
func WithBlockNum(from uint64) ClientOption { return func(c *Client) error { c.fromBlock = from return nil } }
go
func WithBlockNum(from uint64) ClientOption { return func(c *Client) error { c.fromBlock = from return nil } }
[ "func", "WithBlockNum", "(", "from", "uint64", ")", "ClientOption", "{", "return", "func", "(", "c", "*", "Client", ")", "error", "{", "c", ".", "fromBlock", "=", "from", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithBlockNum indicates the block number from which events are to be received. // Only deliverclient supports this
[ "WithBlockNum", "indicates", "the", "block", "number", "from", "which", "events", "are", "to", "be", "received", ".", "Only", "deliverclient", "supports", "this" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/event/opts.go#L25-L30
30,010
hyperledger/fabric-sdk-go
pkg/client/event/opts.go
WithSeekType
func WithSeekType(seek seek.Type) ClientOption { return func(c *Client) error { c.seekType = seek return nil } }
go
func WithSeekType(seek seek.Type) ClientOption { return func(c *Client) error { c.seekType = seek return nil } }
[ "func", "WithSeekType", "(", "seek", "seek", ".", "Type", ")", "ClientOption", "{", "return", "func", "(", "c", "*", "Client", ")", "error", "{", "c", ".", "seekType", "=", "seek", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithSeekType indicates the type of seek desired - newest, oldest or from given block // Only deliverclient supports this
[ "WithSeekType", "indicates", "the", "type", "of", "seek", "desired", "-", "newest", "oldest", "or", "from", "given", "block", "Only", "deliverclient", "supports", "this" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/event/opts.go#L34-L39
30,011
hyperledger/fabric-sdk-go
pkg/fab/events/client/mocks/mockpeer.go
NewMockStatefulPeer
func NewMockStatefulPeer(name, url string, opts ...MockPeerOpt) *MockPeer { p := &MockPeer{ MockPeer: fabmocks.NewMockPeer(name, url), } for _, opt := range opts { opt(p) } return p }
go
func NewMockStatefulPeer(name, url string, opts ...MockPeerOpt) *MockPeer { p := &MockPeer{ MockPeer: fabmocks.NewMockPeer(name, url), } for _, opt := range opts { opt(p) } return p }
[ "func", "NewMockStatefulPeer", "(", "name", ",", "url", "string", ",", "opts", "...", "MockPeerOpt", ")", "*", "MockPeer", "{", "p", ":=", "&", "MockPeer", "{", "MockPeer", ":", "fabmocks", ".", "NewMockPeer", "(", "name", ",", "url", ")", ",", "}", "\...
// NewMockStatefulPeer returns a new MockPeer with the given options
[ "NewMockStatefulPeer", "returns", "a", "new", "MockPeer", "with", "the", "given", "options" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/mocks/mockpeer.go#L40-L48
30,012
hyperledger/fabric-sdk-go
pkg/fab/events/client/mocks/mockpeer.go
BlockHeight
func (p *MockPeer) BlockHeight() uint64 { p.lock.RLock() defer p.lock.RUnlock() return p.blockHeight }
go
func (p *MockPeer) BlockHeight() uint64 { p.lock.RLock() defer p.lock.RUnlock() return p.blockHeight }
[ "func", "(", "p", "*", "MockPeer", ")", "BlockHeight", "(", ")", "uint64", "{", "p", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "lock", ".", "RUnlock", "(", ")", "\n", "return", "p", ".", "blockHeight", "\n", "}" ]
// BlockHeight returns the block height
[ "BlockHeight", "returns", "the", "block", "height" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/mocks/mockpeer.go#L60-L64
30,013
hyperledger/fabric-sdk-go
pkg/fab/events/client/mocks/mockpeer.go
SetBlockHeight
func (p *MockPeer) SetBlockHeight(blockHeight uint64) { p.lock.Lock() defer p.lock.Unlock() p.blockHeight = blockHeight }
go
func (p *MockPeer) SetBlockHeight(blockHeight uint64) { p.lock.Lock() defer p.lock.Unlock() p.blockHeight = blockHeight }
[ "func", "(", "p", "*", "MockPeer", ")", "SetBlockHeight", "(", "blockHeight", "uint64", ")", "{", "p", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "lock", ".", "Unlock", "(", ")", "\n", "p", ".", "blockHeight", "=", "blockHeight", ...
// SetBlockHeight sets the block height
[ "SetBlockHeight", "sets", "the", "block", "height" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/mocks/mockpeer.go#L67-L71
30,014
hyperledger/fabric-sdk-go
pkg/client/ledger/ledger.go
New
func New(channelProvider context.ChannelProvider, opts ...ClientOption) (*Client, error) { channelContext, err := channelProvider() if err != nil { return nil, err } if channelContext.ChannelService() == nil { return nil, errors.New("channel service not initialized") } membership, err := channelContext.Cha...
go
func New(channelProvider context.ChannelProvider, opts ...ClientOption) (*Client, error) { channelContext, err := channelProvider() if err != nil { return nil, err } if channelContext.ChannelService() == nil { return nil, errors.New("channel service not initialized") } membership, err := channelContext.Cha...
[ "func", "New", "(", "channelProvider", "context", ".", "ChannelProvider", ",", "opts", "...", "ClientOption", ")", "(", "*", "Client", ",", "error", ")", "{", "channelContext", ",", "err", ":=", "channelProvider", "(", ")", "\n", "if", "err", "!=", "nil", ...
// New returns a ledger client instance. A ledger client instance provides a handler to query various info on specified channel. // An application that requires interaction with multiple channels should create a separate // instance of the ledger client for each channel. Ledger client supports specific queries only.
[ "New", "returns", "a", "ledger", "client", "instance", ".", "A", "ledger", "client", "instance", "provides", "a", "handler", "to", "query", "various", "info", "on", "specified", "channel", ".", "An", "application", "that", "requires", "interaction", "with", "m...
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/ledger/ledger.go#L63-L119
30,015
hyperledger/fabric-sdk-go
pkg/client/ledger/ledger.go
prepareRequestOpts
func (c *Client) prepareRequestOpts(options ...RequestOption) (requestOptions, error) { opts := requestOptions{} for _, option := range options { err := option(c.ctx, &opts) if err != nil { return opts, errors.WithMessage(err, "Failed to read request opts") } } // Set defaults for max targets if opts.Max...
go
func (c *Client) prepareRequestOpts(options ...RequestOption) (requestOptions, error) { opts := requestOptions{} for _, option := range options { err := option(c.ctx, &opts) if err != nil { return opts, errors.WithMessage(err, "Failed to read request opts") } } // Set defaults for max targets if opts.Max...
[ "func", "(", "c", "*", "Client", ")", "prepareRequestOpts", "(", "options", "...", "RequestOption", ")", "(", "requestOptions", ",", "error", ")", "{", "opts", ":=", "requestOptions", "{", "}", "\n", "for", "_", ",", "option", ":=", "range", "options", "...
//prepareRequestOpts Reads Opts from Option array
[ "prepareRequestOpts", "Reads", "Opts", "from", "Option", "array" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/ledger/ledger.go#L334-L358
30,016
hyperledger/fabric-sdk-go
pkg/fabsdk/provider/chpvdr/cachekey.go
newCtxtCacheKey
func newCtxtCacheKey(ctx fab.ClientContext) (*ctxtCacheKey, error) { identity, err := ctx.Serialize() if err != nil { return nil, err } h := sha256.New() if _, err := h.Write(identity); err != nil { return nil, err } hash := h.Sum(nil) return &ctxtCacheKey{ key: string(hash), context: ctx, }, ni...
go
func newCtxtCacheKey(ctx fab.ClientContext) (*ctxtCacheKey, error) { identity, err := ctx.Serialize() if err != nil { return nil, err } h := sha256.New() if _, err := h.Write(identity); err != nil { return nil, err } hash := h.Sum(nil) return &ctxtCacheKey{ key: string(hash), context: ctx, }, ni...
[ "func", "newCtxtCacheKey", "(", "ctx", "fab", ".", "ClientContext", ")", "(", "*", "ctxtCacheKey", ",", "error", ")", "{", "identity", ",", "err", ":=", "ctx", ".", "Serialize", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "er...
// newCtxtCacheKey returns a new cacheKey
[ "newCtxtCacheKey", "returns", "a", "new", "cacheKey" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fabsdk/provider/chpvdr/cachekey.go#L24-L41
30,017
hyperledger/fabric-sdk-go
pkg/fabsdk/provider/chpvdr/cachekey.go
newEventCacheKey
func newEventCacheKey(chConfig fab.ChannelCfg, opts ...options.Opt) (*eventCacheKey, error) { params := defaultParams() options.Apply(params, opts) h := sha256.New() if _, err := h.Write([]byte(params.getOptKey())); err != nil { return nil, err } hash := h.Sum([]byte(chConfig.ID())) return &eventCacheKey{ ...
go
func newEventCacheKey(chConfig fab.ChannelCfg, opts ...options.Opt) (*eventCacheKey, error) { params := defaultParams() options.Apply(params, opts) h := sha256.New() if _, err := h.Write([]byte(params.getOptKey())); err != nil { return nil, err } hash := h.Sum([]byte(chConfig.ID())) return &eventCacheKey{ ...
[ "func", "newEventCacheKey", "(", "chConfig", "fab", ".", "ChannelCfg", ",", "opts", "...", "options", ".", "Opt", ")", "(", "*", "eventCacheKey", ",", "error", ")", "{", "params", ":=", "defaultParams", "(", ")", "\n", "options", ".", "Apply", "(", "para...
// newEventCacheKey returns a new eventCacheKey
[ "newEventCacheKey", "returns", "a", "new", "eventCacheKey" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fabsdk/provider/chpvdr/cachekey.go#L73-L88
30,018
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
CAConfig
func (c *MockConfig) CAConfig(org string) (*msp.CAConfig, bool) { caConfig := msp.CAConfig{ CAName: "org1", } return &caConfig, true }
go
func (c *MockConfig) CAConfig(org string) (*msp.CAConfig, bool) { caConfig := msp.CAConfig{ CAName: "org1", } return &caConfig, true }
[ "func", "(", "c", "*", "MockConfig", ")", "CAConfig", "(", "org", "string", ")", "(", "*", "msp", ".", "CAConfig", ",", "bool", ")", "{", "caConfig", ":=", "msp", ".", "CAConfig", "{", "CAName", ":", "\"", "\"", ",", "}", "\n\n", "return", "&", "...
// CAConfig not implemented
[ "CAConfig", "not", "implemented" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L103-L109
30,019
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
Timeout
func (c *MockConfig) Timeout(arg fab.TimeoutType) time.Duration { return time.Second * 10 }
go
func (c *MockConfig) Timeout(arg fab.TimeoutType) time.Duration { return time.Second * 10 }
[ "func", "(", "c", "*", "MockConfig", ")", "Timeout", "(", "arg", "fab", ".", "TimeoutType", ")", "time", ".", "Duration", "{", "return", "time", ".", "Second", "*", "10", "\n", "}" ]
//Timeout not implemented
[ "Timeout", "not", "implemented" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L127-L129
30,020
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
PeersConfig
func (c *MockConfig) PeersConfig(org string) ([]fab.PeerConfig, bool) { return nil, false }
go
func (c *MockConfig) PeersConfig(org string) ([]fab.PeerConfig, bool) { return nil, false }
[ "func", "(", "c", "*", "MockConfig", ")", "PeersConfig", "(", "org", "string", ")", "(", "[", "]", "fab", ".", "PeerConfig", ",", "bool", ")", "{", "return", "nil", ",", "false", "\n", "}" ]
// PeersConfig Retrieves the fabric peers from the config file provided
[ "PeersConfig", "Retrieves", "the", "fabric", "peers", "from", "the", "config", "file", "provided" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L132-L134
30,021
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
PeerConfig
func (c *MockConfig) PeerConfig(nameOrURL string) (*fab.PeerConfig, bool) { if nameOrURL == "invalid" { return nil, false } if c.customPeerCfg != nil { return c.customPeerCfg, true } cfg := fab.PeerConfig{ URL: "example.com", } return &cfg, true }
go
func (c *MockConfig) PeerConfig(nameOrURL string) (*fab.PeerConfig, bool) { if nameOrURL == "invalid" { return nil, false } if c.customPeerCfg != nil { return c.customPeerCfg, true } cfg := fab.PeerConfig{ URL: "example.com", } return &cfg, true }
[ "func", "(", "c", "*", "MockConfig", ")", "PeerConfig", "(", "nameOrURL", "string", ")", "(", "*", "fab", ".", "PeerConfig", ",", "bool", ")", "{", "if", "nameOrURL", "==", "\"", "\"", "{", "return", "nil", ",", "false", "\n", "}", "\n", "if", "c",...
// PeerConfig Retrieves a specific peer from the configuration by org and name
[ "PeerConfig", "Retrieves", "a", "specific", "peer", "from", "the", "configuration", "by", "org", "and", "name" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L137-L149
30,022
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
OrderersConfig
func (c *MockConfig) OrderersConfig() []fab.OrdererConfig { oConfig, _ := c.OrdererConfig("") return []fab.OrdererConfig{*oConfig} }
go
func (c *MockConfig) OrderersConfig() []fab.OrdererConfig { oConfig, _ := c.OrdererConfig("") return []fab.OrdererConfig{*oConfig} }
[ "func", "(", "c", "*", "MockConfig", ")", "OrderersConfig", "(", ")", "[", "]", "fab", ".", "OrdererConfig", "{", "oConfig", ",", "_", ":=", "c", ".", "OrdererConfig", "(", "\"", "\"", ")", "\n", "return", "[", "]", "fab", ".", "OrdererConfig", "{", ...
// OrderersConfig returns a list of defined orderers
[ "OrderersConfig", "returns", "a", "list", "of", "defined", "orderers" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L183-L186
30,023
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
OrdererConfig
func (c *MockConfig) OrdererConfig(name string) (*fab.OrdererConfig, bool) { if name == "Invalid" { return nil, false } if c.customOrdererCfg != nil { return c.customOrdererCfg, true } oConfig := fab.OrdererConfig{ URL: "example.com", } return &oConfig, true }
go
func (c *MockConfig) OrdererConfig(name string) (*fab.OrdererConfig, bool) { if name == "Invalid" { return nil, false } if c.customOrdererCfg != nil { return c.customOrdererCfg, true } oConfig := fab.OrdererConfig{ URL: "example.com", } return &oConfig, true }
[ "func", "(", "c", "*", "MockConfig", ")", "OrdererConfig", "(", "name", "string", ")", "(", "*", "fab", ".", "OrdererConfig", ",", "bool", ")", "{", "if", "name", "==", "\"", "\"", "{", "return", "nil", ",", "false", "\n", "}", "\n", "if", "c", "...
// OrdererConfig not implemented
[ "OrdererConfig", "not", "implemented" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L209-L221
30,024
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
SetCustomChannelConfig
func (c *MockConfig) SetCustomChannelConfig(channelID string, config *fab.ChannelEndpointConfig) { if c.chConfig == nil { c.chConfig = make(map[string]*fab.ChannelEndpointConfig) } c.chConfig[channelID] = config }
go
func (c *MockConfig) SetCustomChannelConfig(channelID string, config *fab.ChannelEndpointConfig) { if c.chConfig == nil { c.chConfig = make(map[string]*fab.ChannelEndpointConfig) } c.chConfig[channelID] = config }
[ "func", "(", "c", "*", "MockConfig", ")", "SetCustomChannelConfig", "(", "channelID", "string", ",", "config", "*", "fab", ".", "ChannelEndpointConfig", ")", "{", "if", "c", ".", "chConfig", "==", "nil", "{", "c", ".", "chConfig", "=", "make", "(", "map"...
// SetCustomChannelConfig sets the config for the given channel
[ "SetCustomChannelConfig", "sets", "the", "config", "for", "the", "given", "channel" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L268-L273
30,025
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockconfig.go
Lookup
func (c *MockConfig) Lookup(key string) (interface{}, bool) { if key == "invalid" { return nil, false } value, ok := c.Lookup(key) if !ok { return nil, false } return value, true }
go
func (c *MockConfig) Lookup(key string) (interface{}, bool) { if key == "invalid" { return nil, false } value, ok := c.Lookup(key) if !ok { return nil, false } return value, true }
[ "func", "(", "c", "*", "MockConfig", ")", "Lookup", "(", "key", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "if", "key", "==", "\"", "\"", "{", "return", "nil", ",", "false", "\n", "}", "\n", "value", ",", "ok", ":=", "c",...
// Lookup gets the Value from config file by Key
[ "Lookup", "gets", "the", "Value", "from", "config", "file", "by", "Key" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockconfig.go#L338-L347
30,026
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockbroadcastserver.go
Broadcast
func (m *MockBroadcastServer) Broadcast(server po.AtomicBroadcast_BroadcastServer) error { res, err := server.Recv() if err == io.EOF { return nil } if err != nil { return err } if m.BroadcastError != nil { return m.BroadcastError } if m.BroadcastInternalServerError { return server.Send(broadcastResp...
go
func (m *MockBroadcastServer) Broadcast(server po.AtomicBroadcast_BroadcastServer) error { res, err := server.Recv() if err == io.EOF { return nil } if err != nil { return err } if m.BroadcastError != nil { return m.BroadcastError } if m.BroadcastInternalServerError { return server.Send(broadcastResp...
[ "func", "(", "m", "*", "MockBroadcastServer", ")", "Broadcast", "(", "server", "po", ".", "AtomicBroadcast_BroadcastServer", ")", "error", "{", "res", ",", "err", ":=", "server", ".", "Recv", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "r...
// Broadcast mock broadcast
[ "Broadcast", "mock", "broadcast" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockbroadcastserver.go#L59-L87
30,027
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockbroadcastserver.go
Deliver
func (m *MockBroadcastServer) Deliver(server po.AtomicBroadcast_DeliverServer) error { if m.DeliverError != nil { return m.DeliverError } if m.DeliverResponse != nil { if _, err := server.Recv(); err != nil { return err } if err := server.SendMsg(m.DeliverResponse); err != nil { return err } retur...
go
func (m *MockBroadcastServer) Deliver(server po.AtomicBroadcast_DeliverServer) error { if m.DeliverError != nil { return m.DeliverError } if m.DeliverResponse != nil { if _, err := server.Recv(); err != nil { return err } if err := server.SendMsg(m.DeliverResponse); err != nil { return err } retur...
[ "func", "(", "m", "*", "MockBroadcastServer", ")", "Deliver", "(", "server", "po", ".", "AtomicBroadcast_DeliverServer", ")", "error", "{", "if", "m", ".", "DeliverError", "!=", "nil", "{", "return", "m", ".", "DeliverError", "\n", "}", "\n\n", "if", "m", ...
// Deliver mock deliver
[ "Deliver", "mock", "deliver" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockbroadcastserver.go#L134-L157
30,028
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockbroadcastserver.go
Start
func (m *MockBroadcastServer) Start(address string) string { if m.srv != nil { panic("MockBroadcastServer already started") } // pass in TLS creds if present if m.Creds != nil { m.srv = grpc.NewServer(grpc.Creds(m.Creds)) } else { m.srv = grpc.NewServer() } lis, err := net.Listen("tcp", address) if err ...
go
func (m *MockBroadcastServer) Start(address string) string { if m.srv != nil { panic("MockBroadcastServer already started") } // pass in TLS creds if present if m.Creds != nil { m.srv = grpc.NewServer(grpc.Creds(m.Creds)) } else { m.srv = grpc.NewServer() } lis, err := net.Listen("tcp", address) if err ...
[ "func", "(", "m", "*", "MockBroadcastServer", ")", "Start", "(", "address", "string", ")", "string", "{", "if", "m", ".", "srv", "!=", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// pass in TLS creds if present", "if", "m", ".", "Cre...
// Start the mock broadcast server
[ "Start", "the", "mock", "broadcast", "server" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockbroadcastserver.go#L160-L189
30,029
hyperledger/fabric-sdk-go
pkg/client/common/selection/sorter/blockheightsorter/blockheightsorter.go
New
func New(opts ...coptions.Opt) options.PeerSorter { params := defaultParams() coptions.Apply(params, opts) sorter := &sorter{ params: params, } return func(peers []fab.Peer) []fab.Peer { return sorter.Sort(peers) } }
go
func New(opts ...coptions.Opt) options.PeerSorter { params := defaultParams() coptions.Apply(params, opts) sorter := &sorter{ params: params, } return func(peers []fab.Peer) []fab.Peer { return sorter.Sort(peers) } }
[ "func", "New", "(", "opts", "...", "coptions", ".", "Opt", ")", "options", ".", "PeerSorter", "{", "params", ":=", "defaultParams", "(", ")", "\n", "coptions", ".", "Apply", "(", "params", ",", "opts", ")", "\n\n", "sorter", ":=", "&", "sorter", "{", ...
// New returns a peer sorter that uses block height and the provided balancer to sort the peers. // This sorter uses a block-height-lag-threshold property which is the number of blocks from // the highest block of a group of peers that a peer can lag behind and still be considered to be // up-to-date. These peers are s...
[ "New", "returns", "a", "peer", "sorter", "that", "uses", "block", "height", "and", "the", "provided", "balancer", "to", "sort", "the", "peers", ".", "This", "sorter", "uses", "a", "block", "-", "height", "-", "lag", "-", "threshold", "property", "which", ...
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/common/selection/sorter/blockheightsorter/blockheightsorter.go#L26-L37
30,030
hyperledger/fabric-sdk-go
pkg/client/common/selection/sorter/blockheightsorter/blockheightsorter.go
Sort
func (f *sorter) Sort(peers []fab.Peer) []fab.Peer { if len(peers) <= 1 { return peers } if f.blockHeightLagThreshold < 0 { logger.Debugf("Returning all peers") return f.balancer(peers) } maxHeight := getMaxBlockHeight(peers) logger.Debugf("Max block height of peers: %d", maxHeight) if maxHeight <= uint...
go
func (f *sorter) Sort(peers []fab.Peer) []fab.Peer { if len(peers) <= 1 { return peers } if f.blockHeightLagThreshold < 0 { logger.Debugf("Returning all peers") return f.balancer(peers) } maxHeight := getMaxBlockHeight(peers) logger.Debugf("Max block height of peers: %d", maxHeight) if maxHeight <= uint...
[ "func", "(", "f", "*", "sorter", ")", "Sort", "(", "peers", "[", "]", "fab", ".", "Peer", ")", "[", "]", "fab", ".", "Peer", "{", "if", "len", "(", "peers", ")", "<=", "1", "{", "return", "peers", "\n", "}", "\n\n", "if", "f", ".", "blockHeig...
// Sort sorts the given peers according to block height and lag threshold.
[ "Sort", "sorts", "the", "given", "peers", "according", "to", "block", "height", "and", "lag", "threshold", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/common/selection/sorter/blockheightsorter/blockheightsorter.go#L44-L95
30,031
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockdiscovery.go
CreateLocalDiscoveryService
func (dp *MockStaticDiscoveryProvider) CreateLocalDiscoveryService(mspID string) (fab.DiscoveryService, error) { if dp.customDiscoveryService != nil { return dp.customDiscoveryService, nil } return NewMockDiscoveryService(dp.Error, dp.Peers...), nil }
go
func (dp *MockStaticDiscoveryProvider) CreateLocalDiscoveryService(mspID string) (fab.DiscoveryService, error) { if dp.customDiscoveryService != nil { return dp.customDiscoveryService, nil } return NewMockDiscoveryService(dp.Error, dp.Peers...), nil }
[ "func", "(", "dp", "*", "MockStaticDiscoveryProvider", ")", "CreateLocalDiscoveryService", "(", "mspID", "string", ")", "(", "fab", ".", "DiscoveryService", ",", "error", ")", "{", "if", "dp", ".", "customDiscoveryService", "!=", "nil", "{", "return", "dp", "....
// CreateLocalDiscoveryService return local discovery service
[ "CreateLocalDiscoveryService", "return", "local", "discovery", "service" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockdiscovery.go#L36-L43
30,032
hyperledger/fabric-sdk-go
pkg/fab/mocks/mockdiscovery.go
GetPeers
func (ds *MockStaticDiscoveryService) GetPeers() ([]fab.Peer, error) { if ds.Error != nil { return nil, ds.Error } if ds.Peers == nil { mockPeer := MockPeer{MockName: "Peer1", MockURL: "http://peer1.com", MockRoles: []string{}, MockCert: nil, MockMSP: "Org1MSP"} peers := make([]fab.Peer, 0) peers = append(...
go
func (ds *MockStaticDiscoveryService) GetPeers() ([]fab.Peer, error) { if ds.Error != nil { return nil, ds.Error } if ds.Peers == nil { mockPeer := MockPeer{MockName: "Peer1", MockURL: "http://peer1.com", MockRoles: []string{}, MockCert: nil, MockMSP: "Org1MSP"} peers := make([]fab.Peer, 0) peers = append(...
[ "func", "(", "ds", "*", "MockStaticDiscoveryService", ")", "GetPeers", "(", ")", "(", "[", "]", "fab", ".", "Peer", ",", "error", ")", "{", "if", "ds", ".", "Error", "!=", "nil", "{", "return", "nil", ",", "ds", ".", "Error", "\n", "}", "\n\n", "...
// GetPeers is used to discover eligible peers for chaincode
[ "GetPeers", "is", "used", "to", "discover", "eligible", "peers", "for", "chaincode" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/mocks/mockdiscovery.go#L56-L71
30,033
hyperledger/fabric-sdk-go
pkg/fab/channel/membership/cache.go
NewRefCache
func NewRefCache(refresh time.Duration) *lazycache.Cache { initializer := func(key lazycache.Key) (interface{}, error) { ck, ok := key.(CacheKey) if !ok { return nil, errors.New("unexpected cache key") } return NewRef(refresh, ck.Context(), ck.ChConfigRef()), nil } return lazycache.New("Membership_Cache"...
go
func NewRefCache(refresh time.Duration) *lazycache.Cache { initializer := func(key lazycache.Key) (interface{}, error) { ck, ok := key.(CacheKey) if !ok { return nil, errors.New("unexpected cache key") } return NewRef(refresh, ck.Context(), ck.ChConfigRef()), nil } return lazycache.New("Membership_Cache"...
[ "func", "NewRefCache", "(", "refresh", "time", ".", "Duration", ")", "*", "lazycache", ".", "Cache", "{", "initializer", ":=", "func", "(", "key", "lazycache", ".", "Key", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "ck", ",", "ok", ":="...
// NewRefCache a cache of membership references that refreshed with the // given interval
[ "NewRefCache", "a", "cache", "of", "membership", "references", "that", "refreshed", "with", "the", "given", "interval" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/membership/cache.go#L50-L60
30,034
hyperledger/fabric-sdk-go
pkg/fabsdk/fabsdk_perf.go
initMetrics
func (sdk *FabricSDK) initMetrics(configs *configs) { if configs == nil { return } if sdk.system == nil { sdk.system = newOperationsSystem(configs) err := sdk.system.Start() if err != nil { panic("metrics failed to start: " + err.Error()) } // for now NewClientMetrics supports channel client. TODO: ...
go
func (sdk *FabricSDK) initMetrics(configs *configs) { if configs == nil { return } if sdk.system == nil { sdk.system = newOperationsSystem(configs) err := sdk.system.Start() if err != nil { panic("metrics failed to start: " + err.Error()) } // for now NewClientMetrics supports channel client. TODO: ...
[ "func", "(", "sdk", "*", "FabricSDK", ")", "initMetrics", "(", "configs", "*", "configs", ")", "{", "if", "configs", "==", "nil", "{", "return", "\n", "}", "\n", "if", "sdk", ".", "system", "==", "nil", "{", "sdk", ".", "system", "=", "newOperationsS...
// initMetrics will initialize the Go SDK's metric's system instance to allow capturing metrics data by the SDK clients.
[ "initMetrics", "will", "initialize", "the", "Go", "SDK", "s", "metric", "s", "system", "instance", "to", "allow", "capturing", "metrics", "data", "by", "the", "SDK", "clients", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fabsdk/fabsdk_perf.go#L18-L33
30,035
hyperledger/fabric-sdk-go
pkg/fab/comm/connector.go
NewCachingConnector
func NewCachingConnector(sweepTime time.Duration, idleTime time.Duration) *CachingConnector { cc := CachingConnector{ conns: map[string]*cachedConn{}, index: map[*grpc.ClientConn]*cachedConn{}, janitorDone: make(chan bool, 1), janitorClosed: make(chan bool, 1), sweepTime: sweepTime, i...
go
func NewCachingConnector(sweepTime time.Duration, idleTime time.Duration) *CachingConnector { cc := CachingConnector{ conns: map[string]*cachedConn{}, index: map[*grpc.ClientConn]*cachedConn{}, janitorDone: make(chan bool, 1), janitorClosed: make(chan bool, 1), sweepTime: sweepTime, i...
[ "func", "NewCachingConnector", "(", "sweepTime", "time", ".", "Duration", ",", "idleTime", "time", ".", "Duration", ")", "*", "CachingConnector", "{", "cc", ":=", "CachingConnector", "{", "conns", ":", "map", "[", "string", "]", "*", "cachedConn", "{", "}", ...
// NewCachingConnector creates a GRPC connection cache. The cache is governed by // sweepTime and idleTime.
[ "NewCachingConnector", "creates", "a", "GRPC", "connection", "cache", ".", "The", "cache", "is", "governed", "by", "sweepTime", "and", "idleTime", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/comm/connector.go#L56-L73
30,036
hyperledger/fabric-sdk-go
pkg/fab/comm/connector.go
Close
func (cc *CachingConnector) Close() { cc.lock.RLock() // Safety check to see if the connector has been closed. This represents a // bug in the calling code, but it's not good to panic here. if cc.janitorDone == nil { cc.lock.RUnlock() logger.Warn("Trying to close connector after already closed") return } cc...
go
func (cc *CachingConnector) Close() { cc.lock.RLock() // Safety check to see if the connector has been closed. This represents a // bug in the calling code, but it's not good to panic here. if cc.janitorDone == nil { cc.lock.RUnlock() logger.Warn("Trying to close connector after already closed") return } cc...
[ "func", "(", "cc", "*", "CachingConnector", ")", "Close", "(", ")", "{", "cc", ".", "lock", ".", "RLock", "(", ")", "\n", "// Safety check to see if the connector has been closed. This represents a", "// bug in the calling code, but it's not good to panic here.", "if", "cc"...
// Close cleans up cached connections.
[ "Close", "cleans", "up", "cached", "connections", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/comm/connector.go#L76-L110
30,037
hyperledger/fabric-sdk-go
pkg/fab/comm/connector.go
DialContext
func (cc *CachingConnector) DialContext(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error) { logger.Debugf("DialContext: %s", target) cc.lock.Lock() c, ok := cc.loadConn(target) if !ok { createdConn, err := cc.createConn(ctx, target, opts...) if err != nil { cc.lock.Unloc...
go
func (cc *CachingConnector) DialContext(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error) { logger.Debugf("DialContext: %s", target) cc.lock.Lock() c, ok := cc.loadConn(target) if !ok { createdConn, err := cc.createConn(ctx, target, opts...) if err != nil { cc.lock.Unloc...
[ "func", "(", "cc", "*", "CachingConnector", ")", "DialContext", "(", "ctx", "context", ".", "Context", ",", "target", "string", ",", "opts", "...", "grpc", ".", "DialOption", ")", "(", "*", "grpc", ".", "ClientConn", ",", "error", ")", "{", "logger", "...
// DialContext is a wrapper for grpc.DialContext where connections are cached.
[ "DialContext", "is", "a", "wrapper", "for", "grpc", ".", "DialContext", "where", "connections", "are", "cached", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/comm/connector.go#L113-L136
30,038
hyperledger/fabric-sdk-go
pkg/fab/comm/connector.go
ReleaseConn
func (cc *CachingConnector) ReleaseConn(conn *grpc.ClientConn) { cc.lock.Lock() defer cc.lock.Unlock() // Safety check to see if the connector has been closed. This represents a // bug in the calling code, but it's not good to panic here. if cc.janitorDone == nil { logger.Warn("Trying to release connection afte...
go
func (cc *CachingConnector) ReleaseConn(conn *grpc.ClientConn) { cc.lock.Lock() defer cc.lock.Unlock() // Safety check to see if the connector has been closed. This represents a // bug in the calling code, but it's not good to panic here. if cc.janitorDone == nil { logger.Warn("Trying to release connection afte...
[ "func", "(", "cc", "*", "CachingConnector", ")", "ReleaseConn", "(", "conn", "*", "grpc", ".", "ClientConn", ")", "{", "cc", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "cc", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "// Safety check to see ...
// ReleaseConn notifies the cache that the connection is no longer in use.
[ "ReleaseConn", "notifies", "the", "cache", "that", "the", "connection", "is", "no", "longer", "in", "use", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/comm/connector.go#L139-L167
30,039
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/selectendorsehandler.go
NewSelectAndEndorseHandler
func NewSelectAndEndorseHandler(next ...Handler) Handler { return &SelectAndEndorseHandler{ EndorsementHandler: NewEndorsementHandler(), next: getNext(next), } }
go
func NewSelectAndEndorseHandler(next ...Handler) Handler { return &SelectAndEndorseHandler{ EndorsementHandler: NewEndorsementHandler(), next: getNext(next), } }
[ "func", "NewSelectAndEndorseHandler", "(", "next", "...", "Handler", ")", "Handler", "{", "return", "&", "SelectAndEndorseHandler", "{", "EndorsementHandler", ":", "NewEndorsementHandler", "(", ")", ",", "next", ":", "getNext", "(", "next", ")", ",", "}", "\n", ...
// NewSelectAndEndorseHandler returns a new SelectAndEndorseHandler
[ "NewSelectAndEndorseHandler", "returns", "a", "new", "SelectAndEndorseHandler" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/selectendorsehandler.go#L39-L44
30,040
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/selectendorsehandler.go
Handle
func (e *SelectAndEndorseHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { var ccCalls []*fab.ChaincodeCall targets := requestContext.Opts.Targets if len(targets) == 0 { var err error ccCalls, requestContext.Opts.Targets, err = getEndorsers(requestContext, clientContext) if err !=...
go
func (e *SelectAndEndorseHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { var ccCalls []*fab.ChaincodeCall targets := requestContext.Opts.Targets if len(targets) == 0 { var err error ccCalls, requestContext.Opts.Targets, err = getEndorsers(requestContext, clientContext) if err !=...
[ "func", "(", "e", "*", "SelectAndEndorseHandler", ")", "Handle", "(", "requestContext", "*", "RequestContext", ",", "clientContext", "*", "ClientContext", ")", "{", "var", "ccCalls", "[", "]", "*", "fab", ".", "ChaincodeCall", "\n", "targets", ":=", "requestCo...
// Handle selects endorsers and sends proposals to the endorsers
[ "Handle", "selects", "endorsers", "and", "sends", "proposals", "to", "the", "endorsers" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/selectendorsehandler.go#L47-L92
30,041
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/selectendorsehandler.go
NewChainedCCFilter
func NewChainedCCFilter(filters ...CCFilter) CCFilter { return func(ccID string) bool { for _, filter := range filters { if !filter(ccID) { return false } } return true } }
go
func NewChainedCCFilter(filters ...CCFilter) CCFilter { return func(ccID string) bool { for _, filter := range filters { if !filter(ccID) { return false } } return true } }
[ "func", "NewChainedCCFilter", "(", "filters", "...", "CCFilter", ")", "CCFilter", "{", "return", "func", "(", "ccID", "string", ")", "bool", "{", "for", "_", ",", "filter", ":=", "range", "filters", "{", "if", "!", "filter", "(", "ccID", ")", "{", "ret...
//NewChainedCCFilter returns a chaincode filter that chains //multiple filters together. False is returned if at least one //of the filters in the chain returns false.
[ "NewChainedCCFilter", "returns", "a", "chaincode", "filter", "that", "chains", "multiple", "filters", "together", ".", "False", "is", "returned", "if", "at", "least", "one", "of", "the", "filters", "in", "the", "chain", "returns", "false", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/selectendorsehandler.go#L97-L106
30,042
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/selectendorsehandler.go
getCCCall
func getCCCall(invocChain []*fab.ChaincodeCall, ccID string) (*fab.ChaincodeCall, bool) { for _, ccCall := range invocChain { if ccCall.ID == ccID { return ccCall, true } } return nil, false }
go
func getCCCall(invocChain []*fab.ChaincodeCall, ccID string) (*fab.ChaincodeCall, bool) { for _, ccCall := range invocChain { if ccCall.ID == ccID { return ccCall, true } } return nil, false }
[ "func", "getCCCall", "(", "invocChain", "[", "]", "*", "fab", ".", "ChaincodeCall", ",", "ccID", "string", ")", "(", "*", "fab", ".", "ChaincodeCall", ",", "bool", ")", "{", "for", "_", ",", "ccCall", ":=", "range", "invocChain", "{", "if", "ccCall", ...
// getCC returns the ChaincodeCall from the invocation chain that matches the chaincode ID or // returns nil if the ChaincodeCall is not found.
[ "getCC", "returns", "the", "ChaincodeCall", "from", "the", "invocation", "chain", "that", "matches", "the", "chaincode", "ID", "or", "returns", "nil", "if", "the", "ChaincodeCall", "is", "not", "found", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/selectendorsehandler.go#L264-L271
30,043
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/selectendorsehandler.go
merge
func merge(c1 *fab.ChaincodeCall, c2 *fab.ChaincodeCall) (*fab.ChaincodeCall, bool) { c := &fab.ChaincodeCall{ID: c1.ID, Collections: c1.Collections} merged := false for _, coll := range c2.Collections { if !contains(c.Collections, coll) { c.Collections = append(c.Collections, coll) merged = true } } ret...
go
func merge(c1 *fab.ChaincodeCall, c2 *fab.ChaincodeCall) (*fab.ChaincodeCall, bool) { c := &fab.ChaincodeCall{ID: c1.ID, Collections: c1.Collections} merged := false for _, coll := range c2.Collections { if !contains(c.Collections, coll) { c.Collections = append(c.Collections, coll) merged = true } } ret...
[ "func", "merge", "(", "c1", "*", "fab", ".", "ChaincodeCall", ",", "c2", "*", "fab", ".", "ChaincodeCall", ")", "(", "*", "fab", ".", "ChaincodeCall", ",", "bool", ")", "{", "c", ":=", "&", "fab", ".", "ChaincodeCall", "{", "ID", ":", "c1", ".", ...
// merge merges the collections from c1 and c2 and returns the resulting ChaincodeCall. // true is returned if a merge was necessary; false is returned if the two ChaincodeCalls were the same.
[ "merge", "merges", "the", "collections", "from", "c1", "and", "c2", "and", "returns", "the", "resulting", "ChaincodeCall", ".", "true", "is", "returned", "if", "a", "merge", "was", "necessary", ";", "false", "is", "returned", "if", "the", "two", "ChaincodeCa...
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/selectendorsehandler.go#L275-L285
30,044
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/selectendorsehandler.go
prioritizePeers
func prioritizePeers(peers []fab.Peer) selectopts.PrioritySelector { return func(peer1, peer2 fab.Peer) int { hasPeer1 := containsPeer(peers, peer1) hasPeer2 := containsPeer(peers, peer2) if hasPeer1 && hasPeer2 { return 0 } if hasPeer1 { return 1 } if hasPeer2 { return -1 } return 0 } }
go
func prioritizePeers(peers []fab.Peer) selectopts.PrioritySelector { return func(peer1, peer2 fab.Peer) int { hasPeer1 := containsPeer(peers, peer1) hasPeer2 := containsPeer(peers, peer2) if hasPeer1 && hasPeer2 { return 0 } if hasPeer1 { return 1 } if hasPeer2 { return -1 } return 0 } }
[ "func", "prioritizePeers", "(", "peers", "[", "]", "fab", ".", "Peer", ")", "selectopts", ".", "PrioritySelector", "{", "return", "func", "(", "peer1", ",", "peer2", "fab", ".", "Peer", ")", "int", "{", "hasPeer1", ":=", "containsPeer", "(", "peers", ","...
// prioritizePeers is a priority selector that gives priority to the peers that are in the given set
[ "prioritizePeers", "is", "a", "priority", "selector", "that", "gives", "priority", "to", "the", "peers", "that", "are", "in", "the", "given", "set" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/selectendorsehandler.go#L297-L313
30,045
hyperledger/fabric-sdk-go
pkg/util/concurrent/lazyref/lazyref.go
New
func New(initializer Initializer, opts ...options.Opt) *Reference { return NewWithData(func(interface{}) (interface{}, error) { return initializer() }, opts...) }
go
func New(initializer Initializer, opts ...options.Opt) *Reference { return NewWithData(func(interface{}) (interface{}, error) { return initializer() }, opts...) }
[ "func", "New", "(", "initializer", "Initializer", ",", "opts", "...", "options", ".", "Opt", ")", "*", "Reference", "{", "return", "NewWithData", "(", "func", "(", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return"...
// New creates a new reference
[ "New", "creates", "a", "new", "reference" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/util/concurrent/lazyref/lazyref.go#L88-L92
30,046
hyperledger/fabric-sdk-go
pkg/util/concurrent/lazyref/lazyref.go
NewWithData
func NewWithData(initializer InitializerWithData, opts ...options.Opt) *Reference { lazyRef := &Reference{ params: params{ initialInit: InitOnFirstAccess, }, initializer: initializer, } options.Apply(lazyRef, opts) if lazyRef.expirationProvider != nil { // This is an expiring reference. After the initi...
go
func NewWithData(initializer InitializerWithData, opts ...options.Opt) *Reference { lazyRef := &Reference{ params: params{ initialInit: InitOnFirstAccess, }, initializer: initializer, } options.Apply(lazyRef, opts) if lazyRef.expirationProvider != nil { // This is an expiring reference. After the initi...
[ "func", "NewWithData", "(", "initializer", "InitializerWithData", ",", "opts", "...", "options", ".", "Opt", ")", "*", "Reference", "{", "lazyRef", ":=", "&", "Reference", "{", "params", ":", "params", "{", "initialInit", ":", "InitOnFirstAccess", ",", "}", ...
// NewWithData creates a new reference where data is passed from the Get // function to the initializer. This is useful for refreshing the reference // with dynamic data.
[ "NewWithData", "creates", "a", "new", "reference", "where", "data", "is", "passed", "from", "the", "Get", "function", "to", "the", "initializer", ".", "This", "is", "useful", "for", "refreshing", "the", "reference", "with", "dynamic", "data", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/util/concurrent/lazyref/lazyref.go#L97-L136
30,047
hyperledger/fabric-sdk-go
pkg/util/concurrent/lazyref/lazyref.go
Get
func (r *Reference) Get(data ...interface{}) (interface{}, error) { if r.IsClosed() { return nil, errors.New("reference is already closed") } // Try outside of a lock if value, ok := r.get(); ok { return value, nil } r.lock.Lock() defer r.lock.Unlock() // Try again inside the lock if value, ok := r.get(...
go
func (r *Reference) Get(data ...interface{}) (interface{}, error) { if r.IsClosed() { return nil, errors.New("reference is already closed") } // Try outside of a lock if value, ok := r.get(); ok { return value, nil } r.lock.Lock() defer r.lock.Unlock() // Try again inside the lock if value, ok := r.get(...
[ "func", "(", "r", "*", "Reference", ")", "Get", "(", "data", "...", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "r", ".", "IsClosed", "(", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\""...
// Get returns the value, or an error if the initialiser returned an error.
[ "Get", "returns", "the", "value", "or", "an", "error", "if", "the", "initialiser", "returned", "an", "error", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/util/concurrent/lazyref/lazyref.go#L144-L170
30,048
hyperledger/fabric-sdk-go
pkg/util/concurrent/lazyref/lazyref.go
MustGet
func (r *Reference) MustGet() interface{} { value, err := r.Get() if err != nil { panic(fmt.Sprintf("error returned from Get: %s", err)) } return value }
go
func (r *Reference) MustGet() interface{} { value, err := r.Get() if err != nil { panic(fmt.Sprintf("error returned from Get: %s", err)) } return value }
[ "func", "(", "r", "*", "Reference", ")", "MustGet", "(", ")", "interface", "{", "}", "{", "value", ",", "err", ":=", "r", ".", "Get", "(", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e...
// MustGet returns the value. If an error is returned // during initialization of the value then this function // will panic.
[ "MustGet", "returns", "the", "value", ".", "If", "an", "error", "is", "returned", "during", "initialization", "of", "the", "value", "then", "this", "function", "will", "panic", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/util/concurrent/lazyref/lazyref.go#L175-L181
30,049
hyperledger/fabric-sdk-go
pkg/core/logging/metadata/level.go
GetLevel
func (l *ModuleLevels) GetLevel(module string) api.Level { level, exists := l.levels[module] if !exists { level, exists = l.levels[""] // no configuration exists, default to info if !exists { level = api.INFO } } return level }
go
func (l *ModuleLevels) GetLevel(module string) api.Level { level, exists := l.levels[module] if !exists { level, exists = l.levels[""] // no configuration exists, default to info if !exists { level = api.INFO } } return level }
[ "func", "(", "l", "*", "ModuleLevels", ")", "GetLevel", "(", "module", "string", ")", "api", ".", "Level", "{", "level", ",", "exists", ":=", "l", ".", "levels", "[", "module", "]", "\n", "if", "!", "exists", "{", "level", ",", "exists", "=", "l", ...
// GetLevel returns the log level for the given module.
[ "GetLevel", "returns", "the", "log", "level", "for", "the", "given", "module", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/core/logging/metadata/level.go#L17-L27
30,050
hyperledger/fabric-sdk-go
pkg/core/logging/metadata/level.go
SetLevel
func (l *ModuleLevels) SetLevel(module string, level api.Level) { if l.levels == nil { l.levels = make(map[string]api.Level) } l.levels[module] = level }
go
func (l *ModuleLevels) SetLevel(module string, level api.Level) { if l.levels == nil { l.levels = make(map[string]api.Level) } l.levels[module] = level }
[ "func", "(", "l", "*", "ModuleLevels", ")", "SetLevel", "(", "module", "string", ",", "level", "api", ".", "Level", ")", "{", "if", "l", ".", "levels", "==", "nil", "{", "l", ".", "levels", "=", "make", "(", "map", "[", "string", "]", "api", ".",...
// SetLevel sets the log level for the given module.
[ "SetLevel", "sets", "the", "log", "level", "for", "the", "given", "module", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/core/logging/metadata/level.go#L30-L35
30,051
hyperledger/fabric-sdk-go
pkg/core/logging/metadata/level.go
IsEnabledFor
func (l *ModuleLevels) IsEnabledFor(module string, level api.Level) bool { return level <= l.GetLevel(module) }
go
func (l *ModuleLevels) IsEnabledFor(module string, level api.Level) bool { return level <= l.GetLevel(module) }
[ "func", "(", "l", "*", "ModuleLevels", ")", "IsEnabledFor", "(", "module", "string", ",", "level", "api", ".", "Level", ")", "bool", "{", "return", "level", "<=", "l", ".", "GetLevel", "(", "module", ")", "\n", "}" ]
// IsEnabledFor will return true if logging is enabled for the given module.
[ "IsEnabledFor", "will", "return", "true", "if", "logging", "is", "enabled", "for", "the", "given", "module", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/core/logging/metadata/level.go#L38-L40
30,052
hyperledger/fabric-sdk-go
pkg/fab/chconfig/reference.go
NewRef
func NewRef(ctx fab.ClientContext, pvdr Provider, channel string, opts ...options.Opt) *Ref { params := newDefaultParams() options.Apply(params, opts) cfgRef := &Ref{ pvdr: pvdr, ctx: ctx, channelID: channel, errHandler: params.errHandler, } cfgRef.Reference = lazyref.New( cfgRef.initiali...
go
func NewRef(ctx fab.ClientContext, pvdr Provider, channel string, opts ...options.Opt) *Ref { params := newDefaultParams() options.Apply(params, opts) cfgRef := &Ref{ pvdr: pvdr, ctx: ctx, channelID: channel, errHandler: params.errHandler, } cfgRef.Reference = lazyref.New( cfgRef.initiali...
[ "func", "NewRef", "(", "ctx", "fab", ".", "ClientContext", ",", "pvdr", "Provider", ",", "channel", "string", ",", "opts", "...", "options", ".", "Opt", ")", "*", "Ref", "{", "params", ":=", "newDefaultParams", "(", ")", "\n", "options", ".", "Apply", ...
// NewRef returns a new channel config reference
[ "NewRef", "returns", "a", "new", "channel", "config", "reference" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/chconfig/reference.go#L30-L47
30,053
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
New
func New(dispatcher eventservice.Dispatcher, opts ...options.Opt) *Client { params := defaultParams() options.Apply(params, opts) return &Client{ Service: eventservice.New(dispatcher, opts...), params: *params, connectionState: int32(Disconnected), } }
go
func New(dispatcher eventservice.Dispatcher, opts ...options.Opt) *Client { params := defaultParams() options.Apply(params, opts) return &Client{ Service: eventservice.New(dispatcher, opts...), params: *params, connectionState: int32(Disconnected), } }
[ "func", "New", "(", "dispatcher", "eventservice", ".", "Dispatcher", ",", "opts", "...", "options", ".", "Opt", ")", "*", "Client", "{", "params", ":=", "defaultParams", "(", ")", "\n", "options", ".", "Apply", "(", "params", ",", "opts", ")", "\n\n", ...
// New returns a new event client
[ "New", "returns", "a", "new", "event", "client" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L55-L64
30,054
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
SetAfterConnectHandler
func (c *Client) SetAfterConnectHandler(h handler) { c.Lock() defer c.Unlock() c.afterConnect = h }
go
func (c *Client) SetAfterConnectHandler(h handler) { c.Lock() defer c.Unlock() c.afterConnect = h }
[ "func", "(", "c", "*", "Client", ")", "SetAfterConnectHandler", "(", "h", "handler", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "afterConnect", "=", "h", "\n", "}" ]
// SetAfterConnectHandler registers a handler that is called // after the client connects to the event server. This allows for // custom code to be executed for a particular // event client implementation.
[ "SetAfterConnectHandler", "registers", "a", "handler", "that", "is", "called", "after", "the", "client", "connects", "to", "the", "event", "server", ".", "This", "allows", "for", "custom", "code", "to", "be", "executed", "for", "a", "particular", "event", "cli...
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L70-L74
30,055
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
SetBeforeReconnectHandler
func (c *Client) SetBeforeReconnectHandler(h handler) { c.Lock() defer c.Unlock() c.beforeReconnect = h }
go
func (c *Client) SetBeforeReconnectHandler(h handler) { c.Lock() defer c.Unlock() c.beforeReconnect = h }
[ "func", "(", "c", "*", "Client", ")", "SetBeforeReconnectHandler", "(", "h", "handler", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "beforeReconnect", "=", "h", "\n", "}" ]
// SetBeforeReconnectHandler registers a handler that will be called // before retrying to reconnect to the event server. This allows for // custom code to be executed for a particular event client implementation.
[ "SetBeforeReconnectHandler", "registers", "a", "handler", "that", "will", "be", "called", "before", "retrying", "to", "reconnect", "to", "the", "event", "server", ".", "This", "allows", "for", "custom", "code", "to", "be", "executed", "for", "a", "particular", ...
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L85-L89
30,056
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
Connect
func (c *Client) Connect() error { if c.maxConnAttempts == 1 { return c.connect() } return c.connectWithRetry(c.maxConnAttempts, c.timeBetweenConnAttempts) }
go
func (c *Client) Connect() error { if c.maxConnAttempts == 1 { return c.connect() } return c.connectWithRetry(c.maxConnAttempts, c.timeBetweenConnAttempts) }
[ "func", "(", "c", "*", "Client", ")", "Connect", "(", ")", "error", "{", "if", "c", ".", "maxConnAttempts", "==", "1", "{", "return", "c", ".", "connect", "(", ")", "\n", "}", "\n", "return", "c", ".", "connectWithRetry", "(", "c", ".", "maxConnAtt...
// Connect connects to the peer and registers for events on a particular channel.
[ "Connect", "connects", "to", "the", "peer", "and", "registers", "for", "events", "on", "a", "particular", "channel", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L98-L103
30,057
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
CloseIfIdle
func (c *Client) CloseIfIdle() bool { logger.Debug("Attempting to close event client...") // Check if there are any outstanding registrations regInfoCh := make(chan *esdispatcher.RegistrationInfo) err := c.Submit(esdispatcher.NewRegistrationInfoEvent(regInfoCh)) if err != nil { logger.Debugf("Submit failed %s",...
go
func (c *Client) CloseIfIdle() bool { logger.Debug("Attempting to close event client...") // Check if there are any outstanding registrations regInfoCh := make(chan *esdispatcher.RegistrationInfo) err := c.Submit(esdispatcher.NewRegistrationInfoEvent(regInfoCh)) if err != nil { logger.Debugf("Submit failed %s",...
[ "func", "(", "c", "*", "Client", ")", "CloseIfIdle", "(", ")", "bool", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n\n", "// Check if there are any outstanding registrations", "regInfoCh", ":=", "make", "(", "chan", "*", "esdispatcher", ".", "Registra...
// CloseIfIdle closes the connection to the event server only if there are no outstanding // registrations. // Returns true if the client was closed. In this case the client may no longer be used. // A return value of false indicates that the client could not be closed since // there was at least one registration.
[ "CloseIfIdle", "closes", "the", "connection", "to", "the", "event", "server", "only", "if", "there", "are", "no", "outstanding", "registrations", ".", "Returns", "true", "if", "the", "client", "was", "closed", ".", "In", "this", "case", "the", "client", "may...
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L110-L132
30,058
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
TransferRegistrations
func (c *Client) TransferRegistrations(close bool) (fab.EventSnapshot, error) { if !close { return c.Transfer() } var snapshot fab.EventSnapshot var err error c.close(func() { logger.Debug("Stopping dispatcher and taking snapshot of all registrations...") snapshot, err = c.StopAndTransfer() if err != nil ...
go
func (c *Client) TransferRegistrations(close bool) (fab.EventSnapshot, error) { if !close { return c.Transfer() } var snapshot fab.EventSnapshot var err error c.close(func() { logger.Debug("Stopping dispatcher and taking snapshot of all registrations...") snapshot, err = c.StopAndTransfer() if err != nil ...
[ "func", "(", "c", "*", "Client", ")", "TransferRegistrations", "(", "close", "bool", ")", "(", "fab", ".", "EventSnapshot", ",", "error", ")", "{", "if", "!", "close", "{", "return", "c", ".", "Transfer", "(", ")", "\n", "}", "\n\n", "var", "snapshot...
// TransferRegistrations transfers all registrations into an EventSnapshot. // The registrations are not closed and may susequently be transferred to a // new event client. // - close - if true then the client will also be closed
[ "TransferRegistrations", "transfers", "all", "registrations", "into", "an", "EventSnapshot", ".", "The", "registrations", "are", "not", "closed", "and", "may", "susequently", "be", "transferred", "to", "a", "new", "event", "client", ".", "-", "close", "-", "if",...
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L146-L162
30,059
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
registerConnectionEvent
func (c *Client) registerConnectionEvent() (fab.Registration, chan *dispatcher.ConnectionEvent, error) { if c.Stopped() { return nil, nil, errors.New("event client is closed") } eventch := make(chan *dispatcher.ConnectionEvent, c.eventConsumerBufferSize) errch := make(chan error) regch := make(chan fab.Registra...
go
func (c *Client) registerConnectionEvent() (fab.Registration, chan *dispatcher.ConnectionEvent, error) { if c.Stopped() { return nil, nil, errors.New("event client is closed") } eventch := make(chan *dispatcher.ConnectionEvent, c.eventConsumerBufferSize) errch := make(chan error) regch := make(chan fab.Registra...
[ "func", "(", "c", "*", "Client", ")", "registerConnectionEvent", "(", ")", "(", "fab", ".", "Registration", ",", "chan", "*", "dispatcher", ".", "ConnectionEvent", ",", "error", ")", "{", "if", "c", ".", "Stopped", "(", ")", "{", "return", "nil", ",", ...
// registerConnectionEvent registers a connection event. The returned // ConnectionEvent channel will be called whenever the client clients or disconnects // from the event server
[ "registerConnectionEvent", "registers", "a", "connection", "event", ".", "The", "returned", "ConnectionEvent", "channel", "will", "be", "called", "whenever", "the", "client", "clients", "or", "disconnects", "from", "the", "event", "server" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L319-L337
30,060
hyperledger/fabric-sdk-go
pkg/fab/events/client/client.go
setConnectionState
func (c *Client) setConnectionState(currentState, newState ConnectionState) bool { return atomic.CompareAndSwapInt32(&c.connectionState, int32(currentState), int32(newState)) }
go
func (c *Client) setConnectionState(currentState, newState ConnectionState) bool { return atomic.CompareAndSwapInt32(&c.connectionState, int32(currentState), int32(newState)) }
[ "func", "(", "c", "*", "Client", ")", "setConnectionState", "(", "currentState", ",", "newState", "ConnectionState", ")", "bool", "{", "return", "atomic", ".", "CompareAndSwapInt32", "(", "&", "c", ".", "connectionState", ",", "int32", "(", "currentState", ")"...
// setConnectionState sets the connection state only if the given currentState // matches the actual state. True is returned if the connection state was successfully set.
[ "setConnectionState", "sets", "the", "connection", "state", "only", "if", "the", "given", "currentState", "matches", "the", "actual", "state", ".", "True", "is", "returned", "if", "the", "connection", "state", "was", "successfully", "set", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/client.go#L356-L358
30,061
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/txnhandler.go
Handle
func (e *EndorsementHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { if len(requestContext.Opts.Targets) == 0 { requestContext.Error = status.New(status.ClientStatus, status.NoPeersFound.ToInt32(), "targets were not provided", nil) return } // Endorse Tx var TxnHeaderOpts []fab....
go
func (e *EndorsementHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { if len(requestContext.Opts.Targets) == 0 { requestContext.Error = status.New(status.ClientStatus, status.NoPeersFound.ToInt32(), "targets were not provided", nil) return } // Endorse Tx var TxnHeaderOpts []fab....
[ "func", "(", "e", "*", "EndorsementHandler", ")", "Handle", "(", "requestContext", "*", "RequestContext", ",", "clientContext", "*", "ClientContext", ")", "{", "if", "len", "(", "requestContext", ".", "Opts", ".", "Targets", ")", "==", "0", "{", "requestCont...
//Handle for endorsing transactions
[ "Handle", "for", "endorsing", "transactions" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/txnhandler.go#L35-L73
30,062
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/txnhandler.go
Handle
func (h *ProposalProcessorHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { //Get proposal processor, if not supplied then use selection service to get available peers as endorser if len(requestContext.Opts.Targets) == 0 { var selectionOpts []options.Opt if requestContext.SelectionFi...
go
func (h *ProposalProcessorHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { //Get proposal processor, if not supplied then use selection service to get available peers as endorser if len(requestContext.Opts.Targets) == 0 { var selectionOpts []options.Opt if requestContext.SelectionFi...
[ "func", "(", "h", "*", "ProposalProcessorHandler", ")", "Handle", "(", "requestContext", "*", "RequestContext", ",", "clientContext", "*", "ClientContext", ")", "{", "//Get proposal processor, if not supplied then use selection service to get available peers as endorser", "if", ...
//Handle selects proposal processors
[ "Handle", "selects", "proposal", "processors" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/txnhandler.go#L81-L104
30,063
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/txnhandler.go
Handle
func (f *EndorsementValidationHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { //Filter tx proposal responses err := f.validate(requestContext.Response.Responses) if err != nil { requestContext.Error = errors.WithMessage(err, "endorsement validation failed") return } //Delegate...
go
func (f *EndorsementValidationHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { //Filter tx proposal responses err := f.validate(requestContext.Response.Responses) if err != nil { requestContext.Error = errors.WithMessage(err, "endorsement validation failed") return } //Delegate...
[ "func", "(", "f", "*", "EndorsementValidationHandler", ")", "Handle", "(", "requestContext", "*", "RequestContext", ",", "clientContext", "*", "ClientContext", ")", "{", "//Filter tx proposal responses", "err", ":=", "f", ".", "validate", "(", "requestContext", ".",...
//Handle for Filtering proposal response
[ "Handle", "for", "Filtering", "proposal", "response" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/txnhandler.go#L124-L137
30,064
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/txnhandler.go
Handle
func (c *CommitTxHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { txnID := requestContext.Response.TransactionID //Register Tx event reg, statusNotifier, err := clientContext.EventService.RegisterTxStatusEvent(string(txnID)) // TODO: Change func to use TransactionID instead of string ...
go
func (c *CommitTxHandler) Handle(requestContext *RequestContext, clientContext *ClientContext) { txnID := requestContext.Response.TransactionID //Register Tx event reg, statusNotifier, err := clientContext.EventService.RegisterTxStatusEvent(string(txnID)) // TODO: Change func to use TransactionID instead of string ...
[ "func", "(", "c", "*", "CommitTxHandler", ")", "Handle", "(", "requestContext", "*", "RequestContext", ",", "clientContext", "*", "ClientContext", ")", "{", "txnID", ":=", "requestContext", ".", "Response", ".", "TransactionID", "\n\n", "//Register Tx event", "reg...
//Handle handles commit tx
[ "Handle", "handles", "commit", "tx" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/txnhandler.go#L167-L203
30,065
hyperledger/fabric-sdk-go
pkg/client/channel/invoke/txnhandler.go
NewEndorsementHandlerWithOpts
func NewEndorsementHandlerWithOpts(next Handler, provider TxnHeaderOptsProvider) *EndorsementHandler { return &EndorsementHandler{next: next, headerOptsProvider: provider} }
go
func NewEndorsementHandlerWithOpts(next Handler, provider TxnHeaderOptsProvider) *EndorsementHandler { return &EndorsementHandler{next: next, headerOptsProvider: provider} }
[ "func", "NewEndorsementHandlerWithOpts", "(", "next", "Handler", ",", "provider", "TxnHeaderOptsProvider", ")", "*", "EndorsementHandler", "{", "return", "&", "EndorsementHandler", "{", "next", ":", "next", ",", "headerOptsProvider", ":", "provider", "}", "\n", "}" ...
//NewEndorsementHandlerWithOpts returns a handler that endorses a transaction proposal
[ "NewEndorsementHandlerWithOpts", "returns", "a", "handler", "that", "endorses", "a", "transaction", "proposal" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/client/channel/invoke/txnhandler.go#L236-L238
30,066
hyperledger/fabric-sdk-go
pkg/fab/events/client/lbp/roundrobin.go
Choose
func (lbp *RoundRobin) Choose(peers []fab.Peer) (fab.Peer, error) { if len(peers) == 0 { logger.Warn("No peers to choose from!") return nil, nil } return peers[lbp.counter.Next(len(peers))], nil }
go
func (lbp *RoundRobin) Choose(peers []fab.Peer) (fab.Peer, error) { if len(peers) == 0 { logger.Warn("No peers to choose from!") return nil, nil } return peers[lbp.counter.Next(len(peers))], nil }
[ "func", "(", "lbp", "*", "RoundRobin", ")", "Choose", "(", "peers", "[", "]", "fab", ".", "Peer", ")", "(", "fab", ".", "Peer", ",", "error", ")", "{", "if", "len", "(", "peers", ")", "==", "0", "{", "logger", ".", "Warn", "(", "\"", "\"", ")...
// Choose chooses from the list of peers in round-robin fashion
[ "Choose", "chooses", "from", "the", "list", "of", "peers", "in", "round", "-", "robin", "fashion" ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/events/client/lbp/roundrobin.go#L28-L34
30,067
hyperledger/fabric-sdk-go
pkg/fab/signingmgr/signingmgr.go
New
func New(cryptoProvider core.CryptoSuite) (*SigningManager, error) { return &SigningManager{cryptoProvider: cryptoProvider, hashOpts: cryptosuite.GetSHAOpts()}, nil }
go
func New(cryptoProvider core.CryptoSuite) (*SigningManager, error) { return &SigningManager{cryptoProvider: cryptoProvider, hashOpts: cryptosuite.GetSHAOpts()}, nil }
[ "func", "New", "(", "cryptoProvider", "core", ".", "CryptoSuite", ")", "(", "*", "SigningManager", ",", "error", ")", "{", "return", "&", "SigningManager", "{", "cryptoProvider", ":", "cryptoProvider", ",", "hashOpts", ":", "cryptosuite", ".", "GetSHAOpts", "(...
// New Constructor for a signing manager. // @param {BCCSP} cryptoProvider - crypto provider // @param {Config} config - configuration provider // @returns {SigningManager} new signing manager
[ "New", "Constructor", "for", "a", "signing", "manager", "." ]
48bb0d199e2cee03ad3af0a413bdfc064fc69bfe
https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/signingmgr/signingmgr.go#L27-L29
30,068
gobuffalo/packr
box.go
NewBox
func NewBox(path string) Box { var cd string if !filepath.IsAbs(path) { _, filename, _, _ := runtime.Caller(1) cd = filepath.Dir(filename) } // this little hack courtesy of the `-cover` flag!! cov := filepath.Join("_test", "_obj_test") cd = strings.Replace(cd, string(filepath.Separator)+cov, "", 1) if !file...
go
func NewBox(path string) Box { var cd string if !filepath.IsAbs(path) { _, filename, _, _ := runtime.Caller(1) cd = filepath.Dir(filename) } // this little hack courtesy of the `-cover` flag!! cov := filepath.Join("_test", "_obj_test") cd = strings.Replace(cd, string(filepath.Separator)+cov, "", 1) if !file...
[ "func", "NewBox", "(", "path", "string", ")", "Box", "{", "var", "cd", "string", "\n", "if", "!", "filepath", ".", "IsAbs", "(", "path", ")", "{", "_", ",", "filename", ",", "_", ",", "_", ":=", "runtime", ".", "Caller", "(", "1", ")", "\n", "c...
// NewBox returns a Box that can be used to // retrieve files from either disk or the embedded // binary.
[ "NewBox", "returns", "a", "Box", "that", "can", "be", "used", "to", "retrieve", "files", "from", "either", "disk", "or", "the", "embedded", "binary", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/box.go#L35-L54
30,069
gobuffalo/packr
v2/jam/parser/box.go
String
func (b Box) String() string { x, _ := json.Marshal(b) return string(x) }
go
func (b Box) String() string { x, _ := json.Marshal(b) return string(x) }
[ "func", "(", "b", "Box", ")", "String", "(", ")", "string", "{", "x", ",", "_", ":=", "json", ".", "Marshal", "(", "b", ")", "\n", "return", "string", "(", "x", ")", "\n", "}" ]
// String - json returned
[ "String", "-", "json", "returned" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/jam/parser/box.go#L22-L25
30,070
gobuffalo/packr
v2/jam/parser/box.go
NewBox
func NewBox(name string, path string) *Box { if len(name) == 0 { name = path } name = strings.Replace(name, "\"", "", -1) pwd, _ := os.Getwd() box := &Box{ Name: name, Path: path, PWD: pwd, } return box }
go
func NewBox(name string, path string) *Box { if len(name) == 0 { name = path } name = strings.Replace(name, "\"", "", -1) pwd, _ := os.Getwd() box := &Box{ Name: name, Path: path, PWD: pwd, } return box }
[ "func", "NewBox", "(", "name", "string", ",", "path", "string", ")", "*", "Box", "{", "if", "len", "(", "name", ")", "==", "0", "{", "name", "=", "path", "\n", "}", "\n", "name", "=", "strings", ".", "Replace", "(", "name", ",", "\"", "\\\"", "...
// NewBox stub from the name and the path provided
[ "NewBox", "stub", "from", "the", "name", "and", "the", "path", "provided" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/jam/parser/box.go#L28-L40
30,071
gobuffalo/packr
v2/jam/pack.go
Pack
func Pack(opts PackOptions) error { pwd, err := os.Getwd() if err != nil { return err } opts.Roots = append(opts.Roots, pwd) if err := Clean(opts.Roots...); err != nil { return err } p, err := parser.NewFromRoots(opts.Roots, &parser.RootsOptions{ IgnoreImports: opts.IgnoreImports, }) if err != nil { ...
go
func Pack(opts PackOptions) error { pwd, err := os.Getwd() if err != nil { return err } opts.Roots = append(opts.Roots, pwd) if err := Clean(opts.Roots...); err != nil { return err } p, err := parser.NewFromRoots(opts.Roots, &parser.RootsOptions{ IgnoreImports: opts.IgnoreImports, }) if err != nil { ...
[ "func", "Pack", "(", "opts", "PackOptions", ")", "error", "{", "pwd", ",", "err", ":=", "os", ".", "Getwd", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "opts", ".", "Roots", "=", "append", "(", "opts", ".", ...
// Pack the roots given + PWD
[ "Pack", "the", "roots", "given", "+", "PWD" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/jam/pack.go#L25-L76
30,072
gobuffalo/packr
builder/builder.go
Run
func (b *Builder) Run() error { wg := &errgroup.Group{} root, err := filepath.EvalSymlinks(b.RootPath) if err != nil { return err } err = filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if info == nil { return filepath.SkipDir } base := strings.ToLower(filepath.Base(path)) ...
go
func (b *Builder) Run() error { wg := &errgroup.Group{} root, err := filepath.EvalSymlinks(b.RootPath) if err != nil { return err } err = filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if info == nil { return filepath.SkipDir } base := strings.ToLower(filepath.Base(path)) ...
[ "func", "(", "b", "*", "Builder", ")", "Run", "(", ")", "error", "{", "wg", ":=", "&", "errgroup", ".", "Group", "{", "}", "\n", "root", ",", "err", ":=", "filepath", ".", "EvalSymlinks", "(", "b", ".", "RootPath", ")", "\n", "if", "err", "!=", ...
// Run the builder.
[ "Run", "the", "builder", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/builder/builder.go#L37-L75
30,073
gobuffalo/packr
builder/builder.go
New
func New(ctx context.Context, path string) *Builder { return &Builder{ Context: ctx, RootPath: path, IgnoredBoxes: []string{}, IgnoredFolders: []string{"vendor", ".git", "node_modules", ".idea"}, pkgs: map[string]pkg{}, moot: &sync.Mutex{}, } }
go
func New(ctx context.Context, path string) *Builder { return &Builder{ Context: ctx, RootPath: path, IgnoredBoxes: []string{}, IgnoredFolders: []string{"vendor", ".git", "node_modules", ".idea"}, pkgs: map[string]pkg{}, moot: &sync.Mutex{}, } }
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "*", "Builder", "{", "return", "&", "Builder", "{", "Context", ":", "ctx", ",", "RootPath", ":", "path", ",", "IgnoredBoxes", ":", "[", "]", "string", "{", "}", ",", ...
// New Builder with a given context and path
[ "New", "Builder", "with", "a", "given", "context", "and", "path" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/builder/builder.go#L162-L171
30,074
gobuffalo/packr
v2/jam/parser/file.go
String
func (f *File) String() string { src, _ := ioutil.ReadAll(f) f.Reader = bytes.NewReader(src) return string(src) }
go
func (f *File) String() string { src, _ := ioutil.ReadAll(f) f.Reader = bytes.NewReader(src) return string(src) }
[ "func", "(", "f", "*", "File", ")", "String", "(", ")", "string", "{", "src", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "f", ")", "\n", "f", ".", "Reader", "=", "bytes", ".", "NewReader", "(", "src", ")", "\n", "return", "string", "(", "sr...
// String returns the contents of the reader
[ "String", "returns", "the", "contents", "of", "the", "reader" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/jam/parser/file.go#L23-L27
30,075
gobuffalo/packr
v2/jam/parser/file.go
NewFile
func NewFile(path string, r io.Reader) *File { if r == nil { r = &bytes.Buffer{} } if seek, ok := r.(io.Seeker); ok { seek.Seek(0, 0) } abs := path if !filepath.IsAbs(path) { abs, _ = filepath.Abs(path) } return &File{ Reader: r, Path: path, AbsPath: abs, } }
go
func NewFile(path string, r io.Reader) *File { if r == nil { r = &bytes.Buffer{} } if seek, ok := r.(io.Seeker); ok { seek.Seek(0, 0) } abs := path if !filepath.IsAbs(path) { abs, _ = filepath.Abs(path) } return &File{ Reader: r, Path: path, AbsPath: abs, } }
[ "func", "NewFile", "(", "path", "string", ",", "r", "io", ".", "Reader", ")", "*", "File", "{", "if", "r", "==", "nil", "{", "r", "=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "}", "\n", "if", "seek", ",", "ok", ":=", "r", ".", "(", "io...
// NewFile takes the name of the file you want to // write to and a reader to reader from
[ "NewFile", "takes", "the", "name", "of", "the", "file", "you", "want", "to", "write", "to", "and", "a", "reader", "to", "reader", "from" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/jam/parser/file.go#L38-L54
30,076
gobuffalo/packr
v2/pointer.go
Resolve
func (p Pointer) Resolve(box string, path string) (file.File, error) { plog.Debug(p, "Resolve", "box", box, "path", path, "forward-box", p.ForwardBox, "forward-path", p.ForwardPath) b, err := findBox(p.ForwardBox) if err != nil { return nil, err } f, err := b.Resolve(p.ForwardPath) if err != nil { return f, e...
go
func (p Pointer) Resolve(box string, path string) (file.File, error) { plog.Debug(p, "Resolve", "box", box, "path", path, "forward-box", p.ForwardBox, "forward-path", p.ForwardPath) b, err := findBox(p.ForwardBox) if err != nil { return nil, err } f, err := b.Resolve(p.ForwardPath) if err != nil { return f, e...
[ "func", "(", "p", "Pointer", ")", "Resolve", "(", "box", "string", ",", "path", "string", ")", "(", "file", ".", "File", ",", "error", ")", "{", "plog", ".", "Debug", "(", "p", ",", "\"", "\"", ",", "\"", "\"", ",", "box", ",", "\"", "\"", ",...
// Resolve attempts to find the file in the specific box // with the specified key
[ "Resolve", "attempts", "to", "find", "the", "file", "in", "the", "specific", "box", "with", "the", "specified", "key" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/pointer.go#L21-L33
30,077
gobuffalo/packr
v2/jam/parser/parser.go
Run
func (p *Parser) Run() (Boxes, error) { var boxes Boxes for _, pros := range p.Prospects { plog.Debug(p, "Run", "parsing", pros.Name()) v := NewVisitor(pros) pbr, err := v.Run() if err != nil { return boxes, err } for _, b := range pbr { plog.Debug(p, "Run", "file", pros.Name(), "box", b.Name) bo...
go
func (p *Parser) Run() (Boxes, error) { var boxes Boxes for _, pros := range p.Prospects { plog.Debug(p, "Run", "parsing", pros.Name()) v := NewVisitor(pros) pbr, err := v.Run() if err != nil { return boxes, err } for _, b := range pbr { plog.Debug(p, "Run", "file", pros.Name(), "box", b.Name) bo...
[ "func", "(", "p", "*", "Parser", ")", "Run", "(", ")", "(", "Boxes", ",", "error", ")", "{", "var", "boxes", "Boxes", "\n", "for", "_", ",", "pros", ":=", "range", "p", ".", "Prospects", "{", "plog", ".", "Debug", "(", "p", ",", "\"", "\"", "...
// Run the parser and run any boxes found
[ "Run", "the", "parser", "and", "run", "any", "boxes", "found" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/jam/parser/parser.go#L18-L39
30,078
gobuffalo/packr
packr.go
PackBytes
func PackBytes(box string, name string, bb []byte) { gil.Lock() defer gil.Unlock() if _, ok := data[box]; !ok { data[box] = map[string][]byte{} } data[box][name] = bb }
go
func PackBytes(box string, name string, bb []byte) { gil.Lock() defer gil.Unlock() if _, ok := data[box]; !ok { data[box] = map[string][]byte{} } data[box][name] = bb }
[ "func", "PackBytes", "(", "box", "string", ",", "name", "string", ",", "bb", "[", "]", "byte", ")", "{", "gil", ".", "Lock", "(", ")", "\n", "defer", "gil", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ":=", "data", "[", "box", "]", "...
// PackBytes packs bytes for a file into a box.
[ "PackBytes", "packs", "bytes", "for", "a", "file", "into", "a", "box", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/packr.go#L16-L23
30,079
gobuffalo/packr
packr.go
PackBytesGzip
func PackBytesGzip(box string, name string, bb []byte) error { var buf bytes.Buffer w := gzip.NewWriter(&buf) _, err := w.Write(bb) if err != nil { return err } err = w.Close() if err != nil { return err } PackBytes(box, name, buf.Bytes()) return nil }
go
func PackBytesGzip(box string, name string, bb []byte) error { var buf bytes.Buffer w := gzip.NewWriter(&buf) _, err := w.Write(bb) if err != nil { return err } err = w.Close() if err != nil { return err } PackBytes(box, name, buf.Bytes()) return nil }
[ "func", "PackBytesGzip", "(", "box", "string", ",", "name", "string", ",", "bb", "[", "]", "byte", ")", "error", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "w", ":=", "gzip", ".", "NewWriter", "(", "&", "buf", ")", "\n", "_", ",", "err", ":...
// PackBytesGzip packets the gzipped compressed bytes into a box.
[ "PackBytesGzip", "packets", "the", "gzipped", "compressed", "bytes", "into", "a", "box", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/packr.go#L26-L39
30,080
gobuffalo/packr
packr.go
PackJSONBytes
func PackJSONBytes(box string, name string, jbb string) error { var bb []byte err := json.Unmarshal([]byte(jbb), &bb) if err != nil { return err } PackBytes(box, name, bb) return nil }
go
func PackJSONBytes(box string, name string, jbb string) error { var bb []byte err := json.Unmarshal([]byte(jbb), &bb) if err != nil { return err } PackBytes(box, name, bb) return nil }
[ "func", "PackJSONBytes", "(", "box", "string", ",", "name", "string", ",", "jbb", "string", ")", "error", "{", "var", "bb", "[", "]", "byte", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "[", "]", "byte", "(", "jbb", ")", ",", "&", "bb", ")"...
// PackJSONBytes packs JSON encoded bytes for a file into a box.
[ "PackJSONBytes", "packs", "JSON", "encoded", "bytes", "for", "a", "file", "into", "a", "box", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/packr.go#L42-L50
30,081
gobuffalo/packr
packr.go
UnpackBytes
func UnpackBytes(box string) { gil.Lock() defer gil.Unlock() delete(data, box) }
go
func UnpackBytes(box string) { gil.Lock() defer gil.Unlock() delete(data, box) }
[ "func", "UnpackBytes", "(", "box", "string", ")", "{", "gil", ".", "Lock", "(", ")", "\n", "defer", "gil", ".", "Unlock", "(", ")", "\n", "delete", "(", "data", ",", "box", ")", "\n", "}" ]
// UnpackBytes unpacks bytes for specific box.
[ "UnpackBytes", "unpacks", "bytes", "for", "specific", "box", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/packr.go#L53-L57
30,082
gobuffalo/packr
v2/file/resolver/encoding/hex/hex.go
DecodeString
func DecodeString(s string) ([]byte, error) { src := []byte(s) // We can use the source slice itself as the destination // because the decode loop increments by one and then the 'seen' byte is not used anymore. n, err := Decode(src, src) return src[:n], err }
go
func DecodeString(s string) ([]byte, error) { src := []byte(s) // We can use the source slice itself as the destination // because the decode loop increments by one and then the 'seen' byte is not used anymore. n, err := Decode(src, src) return src[:n], err }
[ "func", "DecodeString", "(", "s", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "src", ":=", "[", "]", "byte", "(", "s", ")", "\n", "// We can use the source slice itself as the destination", "// because the decode loop increments by one and then the '...
// DecodeString returns the bytes represented by the hexadecimal string s. // // DecodeString expects that src contains only hexadecimal // characters and that src has even length. // If the input is malformed, DecodeString returns // the bytes decoded before the error.
[ "DecodeString", "returns", "the", "bytes", "represented", "by", "the", "hexadecimal", "string", "s", ".", "DecodeString", "expects", "that", "src", "contains", "only", "hexadecimal", "characters", "and", "that", "src", "has", "even", "length", ".", "If", "the", ...
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/file/resolver/encoding/hex/hex.go#L108-L114
30,083
gobuffalo/packr
v2/file/resolver/encoding/hex/hex.go
Dump
func Dump(data []byte) string { var buf bytes.Buffer dumper := Dumper(&buf) dumper.Write(data) dumper.Close() return buf.String() }
go
func Dump(data []byte) string { var buf bytes.Buffer dumper := Dumper(&buf) dumper.Write(data) dumper.Close() return buf.String() }
[ "func", "Dump", "(", "data", "[", "]", "byte", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "dumper", ":=", "Dumper", "(", "&", "buf", ")", "\n", "dumper", ".", "Write", "(", "data", ")", "\n", "dumper", ".", "Close", "(", ")",...
// Dump returns a string that contains a hex dump of the given data. The format // of the hex dump matches the output of `hexdump -C` on the command line.
[ "Dump", "returns", "a", "string", "that", "contains", "a", "hex", "dump", "of", "the", "given", "data", ".", "The", "format", "of", "the", "hex", "dump", "matches", "the", "output", "of", "hexdump", "-", "C", "on", "the", "command", "line", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/file/resolver/encoding/hex/hex.go#L118-L124
30,084
gobuffalo/packr
v2/resolvers_map.go
Load
func (m *resolversMap) Load(key string) (resolver.Resolver, bool) { i, ok := m.data.Load(key) if !ok { return nil, false } s, ok := i.(resolver.Resolver) return s, ok }
go
func (m *resolversMap) Load(key string) (resolver.Resolver, bool) { i, ok := m.data.Load(key) if !ok { return nil, false } s, ok := i.(resolver.Resolver) return s, ok }
[ "func", "(", "m", "*", "resolversMap", ")", "Load", "(", "key", "string", ")", "(", "resolver", ".", "Resolver", ",", "bool", ")", "{", "i", ",", "ok", ":=", "m", ".", "data", ".", "Load", "(", "key", ")", "\n", "if", "!", "ok", "{", "return", ...
// Load the key from the map. // Returns resolver.Resolver or bool. // A false return indicates either the key was not found // or the value is not of type resolver.Resolver
[ "Load", "the", "key", "from", "the", "map", ".", "Returns", "resolver", ".", "Resolver", "or", "bool", ".", "A", "false", "return", "indicates", "either", "the", "key", "was", "not", "found", "or", "the", "value", "is", "not", "of", "type", "resolver", ...
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/resolvers_map.go#L29-L36
30,085
gobuffalo/packr
v2/resolvers_map.go
Range
func (m *resolversMap) Range(f func(key string, value resolver.Resolver) bool) { m.data.Range(func(k, v interface{}) bool { key, ok := k.(string) if !ok { return false } value, ok := v.(resolver.Resolver) if !ok { return false } return f(key, value) }) }
go
func (m *resolversMap) Range(f func(key string, value resolver.Resolver) bool) { m.data.Range(func(k, v interface{}) bool { key, ok := k.(string) if !ok { return false } value, ok := v.(resolver.Resolver) if !ok { return false } return f(key, value) }) }
[ "func", "(", "m", "*", "resolversMap", ")", "Range", "(", "f", "func", "(", "key", "string", ",", "value", "resolver", ".", "Resolver", ")", "bool", ")", "{", "m", ".", "data", ".", "Range", "(", "func", "(", "k", ",", "v", "interface", "{", "}",...
// Range over the resolver.Resolver values in the map
[ "Range", "over", "the", "resolver", ".", "Resolver", "values", "in", "the", "map" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/resolvers_map.go#L47-L59
30,086
gobuffalo/packr
v2/resolvers_map.go
Store
func (m *resolversMap) Store(key string, value resolver.Resolver) { m.data.Store(key, value) }
go
func (m *resolversMap) Store(key string, value resolver.Resolver) { m.data.Store(key, value) }
[ "func", "(", "m", "*", "resolversMap", ")", "Store", "(", "key", "string", ",", "value", "resolver", ".", "Resolver", ")", "{", "m", ".", "data", ".", "Store", "(", "key", ",", "value", ")", "\n", "}" ]
// Store a resolver.Resolver in the map
[ "Store", "a", "resolver", ".", "Resolver", "in", "the", "map" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/resolvers_map.go#L62-L64
30,087
gobuffalo/packr
v2/deprecated.go
PackBytes
func PackBytes(box string, name string, bb []byte) { b := NewBox(box) d := resolver.NewInMemory(map[string]file.File{}) f, err := file.NewFile(name, bb) if err != nil { panic(err) } if err := d.Pack(name, f); err != nil { panic(err) } b.SetResolver(name, d) }
go
func PackBytes(box string, name string, bb []byte) { b := NewBox(box) d := resolver.NewInMemory(map[string]file.File{}) f, err := file.NewFile(name, bb) if err != nil { panic(err) } if err := d.Pack(name, f); err != nil { panic(err) } b.SetResolver(name, d) }
[ "func", "PackBytes", "(", "box", "string", ",", "name", "string", ",", "bb", "[", "]", "byte", ")", "{", "b", ":=", "NewBox", "(", "box", ")", "\n", "d", ":=", "resolver", ".", "NewInMemory", "(", "map", "[", "string", "]", "file", ".", "File", "...
// PackBytes packs bytes for a file into a box. // Deprecated
[ "PackBytes", "packs", "bytes", "for", "a", "file", "into", "a", "box", ".", "Deprecated" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/deprecated.go#L23-L34
30,088
gobuffalo/packr
v2/deprecated.go
PackBytesGzip
func PackBytesGzip(box string, name string, bb []byte) error { // TODO: this function never did what it was supposed to do! PackBytes(box, name, bb) return nil }
go
func PackBytesGzip(box string, name string, bb []byte) error { // TODO: this function never did what it was supposed to do! PackBytes(box, name, bb) return nil }
[ "func", "PackBytesGzip", "(", "box", "string", ",", "name", "string", ",", "bb", "[", "]", "byte", ")", "error", "{", "// TODO: this function never did what it was supposed to do!", "PackBytes", "(", "box", ",", "name", ",", "bb", ")", "\n", "return", "nil", "...
// PackBytesGzip packets the gzipped compressed bytes into a box. // Deprecated
[ "PackBytesGzip", "packets", "the", "gzipped", "compressed", "bytes", "into", "a", "box", ".", "Deprecated" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/deprecated.go#L38-L42
30,089
gobuffalo/packr
v2/deprecated.go
String
func (b *Box) String(name string) string { oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.String", "Use github.com/gobuffalo/packr/v2#Box.FindString instead.") return string(b.Bytes(name)) }
go
func (b *Box) String(name string) string { oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.String", "Use github.com/gobuffalo/packr/v2#Box.FindString instead.") return string(b.Bytes(name)) }
[ "func", "(", "b", "*", "Box", ")", "String", "(", "name", "string", ")", "string", "{", "oncer", ".", "Deprecate", "(", "0", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "string", "(", "b", ".", "Bytes", "(", "name", ")", ")", "\n", ...
// String is deprecated. Use FindString instead
[ "String", "is", "deprecated", ".", "Use", "FindString", "instead" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/deprecated.go#L70-L73
30,090
gobuffalo/packr
v2/deprecated.go
MustString
func (b *Box) MustString(name string) (string, error) { oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.MustString", "Use github.com/gobuffalo/packr/v2#Box.FindString instead.") return b.FindString(name) }
go
func (b *Box) MustString(name string) (string, error) { oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.MustString", "Use github.com/gobuffalo/packr/v2#Box.FindString instead.") return b.FindString(name) }
[ "func", "(", "b", "*", "Box", ")", "MustString", "(", "name", "string", ")", "(", "string", ",", "error", ")", "{", "oncer", ".", "Deprecate", "(", "0", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "b", ".", "FindString", "(", "name", ...
// MustString is deprecated. Use FindString instead
[ "MustString", "is", "deprecated", ".", "Use", "FindString", "instead" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/deprecated.go#L76-L79
30,091
gobuffalo/packr
v2/dirs_map.go
Delete
func (m *dirsMap) Delete(key string) { m.data.Delete(m.normalizeKey(key)) }
go
func (m *dirsMap) Delete(key string) { m.data.Delete(m.normalizeKey(key)) }
[ "func", "(", "m", "*", "dirsMap", ")", "Delete", "(", "key", "string", ")", "{", "m", ".", "data", ".", "Delete", "(", "m", ".", "normalizeKey", "(", "key", ")", ")", "\n", "}" ]
// Delete the key from the map
[ "Delete", "the", "key", "from", "the", "map" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/dirs_map.go#L20-L22
30,092
gobuffalo/packr
v2/dirs_map.go
Load
func (m *dirsMap) Load(key string) (bool, bool) { i, ok := m.data.Load(m.normalizeKey(key)) if !ok { return false, false } s, ok := i.(bool) return s, ok }
go
func (m *dirsMap) Load(key string) (bool, bool) { i, ok := m.data.Load(m.normalizeKey(key)) if !ok { return false, false } s, ok := i.(bool) return s, ok }
[ "func", "(", "m", "*", "dirsMap", ")", "Load", "(", "key", "string", ")", "(", "bool", ",", "bool", ")", "{", "i", ",", "ok", ":=", "m", ".", "data", ".", "Load", "(", "m", ".", "normalizeKey", "(", "key", ")", ")", "\n", "if", "!", "ok", "...
// Load the key from the map. // Returns bool or bool. // A false return indicates either the key was not found // or the value is not of type bool
[ "Load", "the", "key", "from", "the", "map", ".", "Returns", "bool", "or", "bool", ".", "A", "false", "return", "indicates", "either", "the", "key", "was", "not", "found", "or", "the", "value", "is", "not", "of", "type", "bool" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/dirs_map.go#L28-L35
30,093
gobuffalo/packr
v2/dirs_map.go
Store
func (m *dirsMap) Store(key string, value bool) { d := m.normalizeKey(key) m.data.Store(d, value) m.data.Store(strings.TrimPrefix(d, "/"), value) }
go
func (m *dirsMap) Store(key string, value bool) { d := m.normalizeKey(key) m.data.Store(d, value) m.data.Store(strings.TrimPrefix(d, "/"), value) }
[ "func", "(", "m", "*", "dirsMap", ")", "Store", "(", "key", "string", ",", "value", "bool", ")", "{", "d", ":=", "m", ".", "normalizeKey", "(", "key", ")", "\n", "m", ".", "data", ".", "Store", "(", "d", ",", "value", ")", "\n", "m", ".", "da...
// Store a bool in the map
[ "Store", "a", "bool", "in", "the", "map" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/dirs_map.go#L61-L65
30,094
gobuffalo/packr
v2/packr2/cmd/fix/runner.go
Run
func Run() error { fmt.Printf("! This updater will attempt to update your application to packr version: %s\n", packr.Version) if !ask("Do you wish to continue?") { fmt.Println("~~~ cancelling update ~~~") return nil } r := &Runner{ Warnings: []string{}, } defer func() { if len(r.Warnings) == 0 { retu...
go
func Run() error { fmt.Printf("! This updater will attempt to update your application to packr version: %s\n", packr.Version) if !ask("Do you wish to continue?") { fmt.Println("~~~ cancelling update ~~~") return nil } r := &Runner{ Warnings: []string{}, } defer func() { if len(r.Warnings) == 0 { retu...
[ "func", "Run", "(", ")", "error", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "packr", ".", "Version", ")", "\n", "if", "!", "ask", "(", "\"", "\"", ")", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "nil", "\n...
// Run all compatible checks
[ "Run", "all", "compatible", "checks" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/packr2/cmd/fix/runner.go#L18-L47
30,095
gobuffalo/packr
v2/box.go
New
func New(name string, path string) *Box { plog.Debug("packr", "New", "name", name, "path", path) b, _ := findBox(name) if b != nil { return b } b = construct(name, path) plog.Debug(b, "New", "Box", b, "ResolutionDir", b.ResolutionDir) b, err := placeBox(b) if err != nil { panic(err) } return b }
go
func New(name string, path string) *Box { plog.Debug("packr", "New", "name", name, "path", path) b, _ := findBox(name) if b != nil { return b } b = construct(name, path) plog.Debug(b, "New", "Box", b, "ResolutionDir", b.ResolutionDir) b, err := placeBox(b) if err != nil { panic(err) } return b }
[ "func", "New", "(", "name", "string", ",", "path", "string", ")", "*", "Box", "{", "plog", ".", "Debug", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "name", ",", "\"", "\"", ",", "path", ")", "\n", "b", ",", "_", ":=", "findBox", ...
// New returns a new Box with the name of the box // and the path of the box.
[ "New", "returns", "a", "new", "Box", "with", "the", "name", "of", "the", "box", "and", "the", "path", "of", "the", "box", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/box.go#L51-L66
30,096
gobuffalo/packr
v2/box.go
SetResolver
func (b *Box) SetResolver(file string, res resolver.Resolver) { d := filepath.Dir(file) b.dirs.Store(d, true) plog.Debug(b, "SetResolver", "file", file, "resolver", fmt.Sprintf("%T", res)) b.resolvers.Store(resolver.Key(file), res) }
go
func (b *Box) SetResolver(file string, res resolver.Resolver) { d := filepath.Dir(file) b.dirs.Store(d, true) plog.Debug(b, "SetResolver", "file", file, "resolver", fmt.Sprintf("%T", res)) b.resolvers.Store(resolver.Key(file), res) }
[ "func", "(", "b", "*", "Box", ")", "SetResolver", "(", "file", "string", ",", "res", "resolver", ".", "Resolver", ")", "{", "d", ":=", "filepath", ".", "Dir", "(", "file", ")", "\n", "b", ".", "dirs", ".", "Store", "(", "d", ",", "true", ")", "...
// SetResolver allows for the use of a custom resolver for // the specified file
[ "SetResolver", "allows", "for", "the", "use", "of", "a", "custom", "resolver", "for", "the", "specified", "file" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/box.go#L77-L82
30,097
gobuffalo/packr
v2/box.go
AddString
func (b *Box) AddString(path string, t string) error { return b.AddBytes(path, []byte(t)) }
go
func (b *Box) AddString(path string, t string) error { return b.AddBytes(path, []byte(t)) }
[ "func", "(", "b", "*", "Box", ")", "AddString", "(", "path", "string", ",", "t", "string", ")", "error", "{", "return", "b", ".", "AddBytes", "(", "path", ",", "[", "]", "byte", "(", "t", ")", ")", "\n", "}" ]
// AddString converts t to a byteslice and delegates to AddBytes to add to b.data
[ "AddString", "converts", "t", "to", "a", "byteslice", "and", "delegates", "to", "AddBytes", "to", "add", "to", "b", ".", "data" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/box.go#L85-L87
30,098
gobuffalo/packr
v2/box.go
AddBytes
func (b *Box) AddBytes(path string, t []byte) error { m := map[string]file.File{} f, err := file.NewFile(path, t) if err != nil { return err } m[resolver.Key(path)] = f res := resolver.NewInMemory(m) b.SetResolver(path, res) return nil }
go
func (b *Box) AddBytes(path string, t []byte) error { m := map[string]file.File{} f, err := file.NewFile(path, t) if err != nil { return err } m[resolver.Key(path)] = f res := resolver.NewInMemory(m) b.SetResolver(path, res) return nil }
[ "func", "(", "b", "*", "Box", ")", "AddBytes", "(", "path", "string", ",", "t", "[", "]", "byte", ")", "error", "{", "m", ":=", "map", "[", "string", "]", "file", ".", "File", "{", "}", "\n", "f", ",", "err", ":=", "file", ".", "NewFile", "("...
// AddBytes sets t in b.data by the given path
[ "AddBytes", "sets", "t", "in", "b", ".", "data", "by", "the", "given", "path" ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/box.go#L90-L100
30,099
gobuffalo/packr
v2/box.go
FindString
func (b *Box) FindString(name string) (string, error) { bb, err := b.Find(name) return string(bb), err }
go
func (b *Box) FindString(name string) (string, error) { bb, err := b.Find(name) return string(bb), err }
[ "func", "(", "b", "*", "Box", ")", "FindString", "(", "name", "string", ")", "(", "string", ",", "error", ")", "{", "bb", ",", "err", ":=", "b", ".", "Find", "(", "name", ")", "\n", "return", "string", "(", "bb", ")", ",", "err", "\n", "}" ]
// FindString returns either the string of the requested // file or an error if it can not be found.
[ "FindString", "returns", "either", "the", "string", "of", "the", "requested", "file", "or", "an", "error", "if", "it", "can", "not", "be", "found", "." ]
9819ef1571983a956c49475cb0524d8a4971620f
https://github.com/gobuffalo/packr/blob/9819ef1571983a956c49475cb0524d8a4971620f/v2/box.go#L104-L107