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
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
29,900
ory/fosite
internal/access_response.go
SetExtra
func (m *MockAccessResponder) SetExtra(arg0 string, arg1 interface{}) { m.ctrl.Call(m, "SetExtra", arg0, arg1) }
go
func (m *MockAccessResponder) SetExtra(arg0 string, arg1 interface{}) { m.ctrl.Call(m, "SetExtra", arg0, arg1) }
[ "func", "(", "m", "*", "MockAccessResponder", ")", "SetExtra", "(", "arg0", "string", ",", "arg1", "interface", "{", "}", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "}" ]
// SetExtra mocks base method
[ "SetExtra", "mocks", "base", "method" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L96-L98
29,901
ory/fosite
internal/access_response.go
SetScopes
func (m *MockAccessResponder) SetScopes(arg0 fosite.Arguments) { m.ctrl.Call(m, "SetScopes", arg0) }
go
func (m *MockAccessResponder) SetScopes(arg0 fosite.Arguments) { m.ctrl.Call(m, "SetScopes", arg0) }
[ "func", "(", "m", "*", "MockAccessResponder", ")", "SetScopes", "(", "arg0", "fosite", ".", "Arguments", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]
// SetScopes mocks base method
[ "SetScopes", "mocks", "base", "method" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L106-L108
29,902
ory/fosite
internal/access_response.go
SetTokenType
func (m *MockAccessResponder) SetTokenType(arg0 string) { m.ctrl.Call(m, "SetTokenType", arg0) }
go
func (m *MockAccessResponder) SetTokenType(arg0 string) { m.ctrl.Call(m, "SetTokenType", arg0) }
[ "func", "(", "m", "*", "MockAccessResponder", ")", "SetTokenType", "(", "arg0", "string", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]
// SetTokenType mocks base method
[ "SetTokenType", "mocks", "base", "method" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L116-L118
29,903
ory/fosite
internal/access_response.go
ToMap
func (mr *MockAccessResponderMockRecorder) ToMap() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToMap", reflect.TypeOf((*MockAccessResponder)(nil).ToMap)) }
go
func (mr *MockAccessResponderMockRecorder) ToMap() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToMap", reflect.TypeOf((*MockAccessResponder)(nil).ToMap)) }
[ "func", "(", "mr", "*", "MockAccessResponderMockRecorder", ")", "ToMap", "(", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", ...
// ToMap indicates an expected call of ToMap
[ "ToMap", "indicates", "an", "expected", "call", "of", "ToMap" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/access_response.go#L133-L135
29,904
ory/fosite
internal/revoke_handler.go
NewMockRevocationHandler
func NewMockRevocationHandler(ctrl *gomock.Controller) *MockRevocationHandler { mock := &MockRevocationHandler{ctrl: ctrl} mock.recorder = &MockRevocationHandlerMockRecorder{mock} return mock }
go
func NewMockRevocationHandler(ctrl *gomock.Controller) *MockRevocationHandler { mock := &MockRevocationHandler{ctrl: ctrl} mock.recorder = &MockRevocationHandlerMockRecorder{mock} return mock }
[ "func", "NewMockRevocationHandler", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockRevocationHandler", "{", "mock", ":=", "&", "MockRevocationHandler", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockRevocationHandlerM...
// NewMockRevocationHandler creates a new mock instance
[ "NewMockRevocationHandler", "creates", "a", "new", "mock", "instance" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/revoke_handler.go#L28-L32
29,905
ory/fosite
internal/revoke_handler.go
RevokeToken
func (m *MockRevocationHandler) RevokeToken(arg0 context.Context, arg1 string, arg2 fosite.TokenType, arg3 fosite.Client) error { ret := m.ctrl.Call(m, "RevokeToken", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockRevocationHandler) RevokeToken(arg0 context.Context, arg1 string, arg2 fosite.TokenType, arg3 fosite.Client) error { ret := m.ctrl.Call(m, "RevokeToken", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockRevocationHandler", ")", "RevokeToken", "(", "arg0", "context", ".", "Context", ",", "arg1", "string", ",", "arg2", "fosite", ".", "TokenType", ",", "arg3", "fosite", ".", "Client", ")", "error", "{", "ret", ":=", "m", ".", ...
// RevokeToken mocks base method
[ "RevokeToken", "mocks", "base", "method" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/revoke_handler.go#L40-L44
29,906
ory/fosite
internal/revoke_handler.go
RevokeToken
func (mr *MockRevocationHandlerMockRecorder) RevokeToken(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeToken", reflect.TypeOf((*MockRevocationHandler)(nil).RevokeToken), arg0, arg1, arg2, arg3) }
go
func (mr *MockRevocationHandlerMockRecorder) RevokeToken(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeToken", reflect.TypeOf((*MockRevocationHandler)(nil).RevokeToken), arg0, arg1, arg2, arg3) }
[ "func", "(", "mr", "*", "MockRevocationHandlerMockRecorder", ")", "RevokeToken", "(", "arg0", ",", "arg1", ",", "arg2", ",", "arg3", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWi...
// RevokeToken indicates an expected call of RevokeToken
[ "RevokeToken", "indicates", "an", "expected", "call", "of", "RevokeToken" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/revoke_handler.go#L47-L49
29,907
ory/fosite
fosite.go
Append
func (a *AuthorizeEndpointHandlers) Append(h AuthorizeEndpointHandler) { for _, this := range *a { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *a = append(*a, h) }
go
func (a *AuthorizeEndpointHandlers) Append(h AuthorizeEndpointHandler) { for _, this := range *a { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *a = append(*a, h) }
[ "func", "(", "a", "*", "AuthorizeEndpointHandlers", ")", "Append", "(", "h", "AuthorizeEndpointHandler", ")", "{", "for", "_", ",", "this", ":=", "range", "*", "a", "{", "if", "reflect", ".", "TypeOf", "(", "this", ")", "==", "reflect", ".", "TypeOf", ...
// Append adds an AuthorizeEndpointHandler to this list. Ignores duplicates based on reflect.TypeOf.
[ "Append", "adds", "an", "AuthorizeEndpointHandler", "to", "this", "list", ".", "Ignores", "duplicates", "based", "on", "reflect", ".", "TypeOf", "." ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L33-L41
29,908
ory/fosite
fosite.go
Append
func (t *TokenEndpointHandlers) Append(h TokenEndpointHandler) { for _, this := range *t { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *t = append(*t, h) }
go
func (t *TokenEndpointHandlers) Append(h TokenEndpointHandler) { for _, this := range *t { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *t = append(*t, h) }
[ "func", "(", "t", "*", "TokenEndpointHandlers", ")", "Append", "(", "h", "TokenEndpointHandler", ")", "{", "for", "_", ",", "this", ":=", "range", "*", "t", "{", "if", "reflect", ".", "TypeOf", "(", "this", ")", "==", "reflect", ".", "TypeOf", "(", "...
// Append adds an TokenEndpointHandler to this list. Ignores duplicates based on reflect.TypeOf.
[ "Append", "adds", "an", "TokenEndpointHandler", "to", "this", "list", ".", "Ignores", "duplicates", "based", "on", "reflect", ".", "TypeOf", "." ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L47-L55
29,909
ory/fosite
fosite.go
Append
func (t *TokenIntrospectionHandlers) Append(h TokenIntrospector) { for _, this := range *t { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *t = append(*t, h) }
go
func (t *TokenIntrospectionHandlers) Append(h TokenIntrospector) { for _, this := range *t { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *t = append(*t, h) }
[ "func", "(", "t", "*", "TokenIntrospectionHandlers", ")", "Append", "(", "h", "TokenIntrospector", ")", "{", "for", "_", ",", "this", ":=", "range", "*", "t", "{", "if", "reflect", ".", "TypeOf", "(", "this", ")", "==", "reflect", ".", "TypeOf", "(", ...
// Add adds an AccessTokenValidator to this list. Ignores duplicates based on reflect.TypeOf.
[ "Add", "adds", "an", "AccessTokenValidator", "to", "this", "list", ".", "Ignores", "duplicates", "based", "on", "reflect", ".", "TypeOf", "." ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L61-L69
29,910
ory/fosite
fosite.go
Append
func (t *RevocationHandlers) Append(h RevocationHandler) { for _, this := range *t { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *t = append(*t, h) }
go
func (t *RevocationHandlers) Append(h RevocationHandler) { for _, this := range *t { if reflect.TypeOf(this) == reflect.TypeOf(h) { return } } *t = append(*t, h) }
[ "func", "(", "t", "*", "RevocationHandlers", ")", "Append", "(", "h", "RevocationHandler", ")", "{", "for", "_", ",", "this", ":=", "range", "*", "t", "{", "if", "reflect", ".", "TypeOf", "(", "this", ")", "==", "reflect", ".", "TypeOf", "(", "h", ...
// Append adds an RevocationHandler to this list. Ignores duplicates based on reflect.TypeOf.
[ "Append", "adds", "an", "RevocationHandler", "to", "this", "list", ".", "Ignores", "duplicates", "based", "on", "reflect", ".", "TypeOf", "." ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/fosite.go#L75-L83
29,911
ory/fosite
internal/id_token_strategy.go
NewMockOpenIDConnectTokenStrategy
func NewMockOpenIDConnectTokenStrategy(ctrl *gomock.Controller) *MockOpenIDConnectTokenStrategy { mock := &MockOpenIDConnectTokenStrategy{ctrl: ctrl} mock.recorder = &MockOpenIDConnectTokenStrategyMockRecorder{mock} return mock }
go
func NewMockOpenIDConnectTokenStrategy(ctrl *gomock.Controller) *MockOpenIDConnectTokenStrategy { mock := &MockOpenIDConnectTokenStrategy{ctrl: ctrl} mock.recorder = &MockOpenIDConnectTokenStrategyMockRecorder{mock} return mock }
[ "func", "NewMockOpenIDConnectTokenStrategy", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockOpenIDConnectTokenStrategy", "{", "mock", ":=", "&", "MockOpenIDConnectTokenStrategy", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&"...
// NewMockOpenIDConnectTokenStrategy creates a new mock instance
[ "NewMockOpenIDConnectTokenStrategy", "creates", "a", "new", "mock", "instance" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/id_token_strategy.go#L28-L32
29,912
ory/fosite
internal/id_token_strategy.go
GenerateIDToken
func (m *MockOpenIDConnectTokenStrategy) GenerateIDToken(arg0 context.Context, arg1 fosite.Requester) (string, error) { ret := m.ctrl.Call(m, "GenerateIDToken", arg0, arg1) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockOpenIDConnectTokenStrategy) GenerateIDToken(arg0 context.Context, arg1 fosite.Requester) (string, error) { ret := m.ctrl.Call(m, "GenerateIDToken", arg0, arg1) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockOpenIDConnectTokenStrategy", ")", "GenerateIDToken", "(", "arg0", "context", ".", "Context", ",", "arg1", "fosite", ".", "Requester", ")", "(", "string", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(",...
// GenerateIDToken mocks base method
[ "GenerateIDToken", "mocks", "base", "method" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/id_token_strategy.go#L40-L45
29,913
ory/fosite
internal/id_token_strategy.go
GenerateIDToken
func (mr *MockOpenIDConnectTokenStrategyMockRecorder) GenerateIDToken(arg0, arg1 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateIDToken", reflect.TypeOf((*MockOpenIDConnectTokenStrategy)(nil).GenerateIDToken), arg0, arg1) }
go
func (mr *MockOpenIDConnectTokenStrategyMockRecorder) GenerateIDToken(arg0, arg1 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GenerateIDToken", reflect.TypeOf((*MockOpenIDConnectTokenStrategy)(nil).GenerateIDToken), arg0, arg1) }
[ "func", "(", "mr", "*", "MockOpenIDConnectTokenStrategyMockRecorder", ")", "GenerateIDToken", "(", "arg0", ",", "arg1", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(",...
// GenerateIDToken indicates an expected call of GenerateIDToken
[ "GenerateIDToken", "indicates", "an", "expected", "call", "of", "GenerateIDToken" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/id_token_strategy.go#L48-L50
29,914
ory/fosite
internal/transactional.go
NewMockTransactional
func NewMockTransactional(ctrl *gomock.Controller) *MockTransactional { mock := &MockTransactional{ctrl: ctrl} mock.recorder = &MockTransactionalMockRecorder{mock} return mock }
go
func NewMockTransactional(ctrl *gomock.Controller) *MockTransactional { mock := &MockTransactional{ctrl: ctrl} mock.recorder = &MockTransactionalMockRecorder{mock} return mock }
[ "func", "NewMockTransactional", "(", "ctrl", "*", "gomock", ".", "Controller", ")", "*", "MockTransactional", "{", "mock", ":=", "&", "MockTransactional", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockTransactionalMockRecorder", ...
// NewMockTransactional creates a new mock instance
[ "NewMockTransactional", "creates", "a", "new", "mock", "instance" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L26-L30
29,915
ory/fosite
internal/transactional.go
BeginTX
func (m *MockTransactional) BeginTX(arg0 context.Context) (context.Context, error) { ret := m.ctrl.Call(m, "BeginTX", arg0) ret0, _ := ret[0].(context.Context) ret1, _ := ret[1].(error) return ret0, ret1 }
go
func (m *MockTransactional) BeginTX(arg0 context.Context) (context.Context, error) { ret := m.ctrl.Call(m, "BeginTX", arg0) ret0, _ := ret[0].(context.Context) ret1, _ := ret[1].(error) return ret0, ret1 }
[ "func", "(", "m", "*", "MockTransactional", ")", "BeginTX", "(", "arg0", "context", ".", "Context", ")", "(", "context", ".", "Context", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", "...
// BeginTX mocks base method
[ "BeginTX", "mocks", "base", "method" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L38-L43
29,916
ory/fosite
internal/transactional.go
Rollback
func (m *MockTransactional) Rollback(arg0 context.Context) error { ret := m.ctrl.Call(m, "Rollback", arg0) ret0, _ := ret[0].(error) return ret0 }
go
func (m *MockTransactional) Rollback(arg0 context.Context) error { ret := m.ctrl.Call(m, "Rollback", arg0) ret0, _ := ret[0].(error) return ret0 }
[ "func", "(", "m", "*", "MockTransactional", ")", "Rollback", "(", "arg0", "context", ".", "Context", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", ...
// Rollback mocks base method
[ "Rollback", "mocks", "base", "method" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L63-L67
29,917
ory/fosite
internal/transactional.go
Rollback
func (mr *MockTransactionalMockRecorder) Rollback(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rollback", reflect.TypeOf((*MockTransactional)(nil).Rollback), arg0) }
go
func (mr *MockTransactionalMockRecorder) Rollback(arg0 interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rollback", reflect.TypeOf((*MockTransactional)(nil).Rollback), arg0) }
[ "func", "(", "mr", "*", "MockTransactionalMockRecorder", ")", "Rollback", "(", "arg0", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\...
// Rollback indicates an expected call of Rollback
[ "Rollback", "indicates", "an", "expected", "call", "of", "Rollback" ]
27bbe0033273157ea449310c064675127e2550e6
https://github.com/ory/fosite/blob/27bbe0033273157ea449310c064675127e2550e6/internal/transactional.go#L70-L72
29,918
cskr/pubsub
pubsub.go
New
func New(capacity int) *PubSub { ps := &PubSub{make(chan cmd), capacity} go ps.start() return ps }
go
func New(capacity int) *PubSub { ps := &PubSub{make(chan cmd), capacity} go ps.start() return ps }
[ "func", "New", "(", "capacity", "int", ")", "*", "PubSub", "{", "ps", ":=", "&", "PubSub", "{", "make", "(", "chan", "cmd", ")", ",", "capacity", "}", "\n", "go", "ps", ".", "start", "(", ")", "\n", "return", "ps", "\n", "}" ]
// New creates a new PubSub and starts a goroutine for handling operations. // The capacity of the channels created by Sub and SubOnce will be as specified.
[ "New", "creates", "a", "new", "PubSub", "and", "starts", "a", "goroutine", "for", "handling", "operations", ".", "The", "capacity", "of", "the", "channels", "created", "by", "Sub", "and", "SubOnce", "will", "be", "as", "specified", "." ]
65166f5ae403cbf6dcdced31e1f8f8ad95485cb3
https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L42-L46
29,919
cskr/pubsub
pubsub.go
AddSub
func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) { ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch} }
go
func (ps *PubSub) AddSub(ch chan interface{}, topics ...string) { ps.cmdChan <- cmd{op: sub, topics: topics, ch: ch} }
[ "func", "(", "ps", "*", "PubSub", ")", "AddSub", "(", "ch", "chan", "interface", "{", "}", ",", "topics", "...", "string", ")", "{", "ps", ".", "cmdChan", "<-", "cmd", "{", "op", ":", "sub", ",", "topics", ":", "topics", ",", "ch", ":", "ch", "...
// AddSub adds subscriptions to an existing channel.
[ "AddSub", "adds", "subscriptions", "to", "an", "existing", "channel", "." ]
65166f5ae403cbf6dcdced31e1f8f8ad95485cb3
https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L73-L75
29,920
cskr/pubsub
pubsub.go
AddSubOnceEach
func (ps *PubSub) AddSubOnceEach(ch chan interface{}, topics ...string) { ps.cmdChan <- cmd{op: subOnceEach, topics: topics, ch: ch} }
go
func (ps *PubSub) AddSubOnceEach(ch chan interface{}, topics ...string) { ps.cmdChan <- cmd{op: subOnceEach, topics: topics, ch: ch} }
[ "func", "(", "ps", "*", "PubSub", ")", "AddSubOnceEach", "(", "ch", "chan", "interface", "{", "}", ",", "topics", "...", "string", ")", "{", "ps", ".", "cmdChan", "<-", "cmd", "{", "op", ":", "subOnceEach", ",", "topics", ":", "topics", ",", "ch", ...
// AddSubOnceEach adds subscriptions to an existing channel with SubOnceEach // behavior.
[ "AddSubOnceEach", "adds", "subscriptions", "to", "an", "existing", "channel", "with", "SubOnceEach", "behavior", "." ]
65166f5ae403cbf6dcdced31e1f8f8ad95485cb3
https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L79-L81
29,921
cskr/pubsub
pubsub.go
Pub
func (ps *PubSub) Pub(msg interface{}, topics ...string) { ps.cmdChan <- cmd{op: pub, topics: topics, msg: msg} }
go
func (ps *PubSub) Pub(msg interface{}, topics ...string) { ps.cmdChan <- cmd{op: pub, topics: topics, msg: msg} }
[ "func", "(", "ps", "*", "PubSub", ")", "Pub", "(", "msg", "interface", "{", "}", ",", "topics", "...", "string", ")", "{", "ps", ".", "cmdChan", "<-", "cmd", "{", "op", ":", "pub", ",", "topics", ":", "topics", ",", "msg", ":", "msg", "}", "\n"...
// Pub publishes the given message to all subscribers of // the specified topics.
[ "Pub", "publishes", "the", "given", "message", "to", "all", "subscribers", "of", "the", "specified", "topics", "." ]
65166f5ae403cbf6dcdced31e1f8f8ad95485cb3
https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L85-L87
29,922
cskr/pubsub
pubsub.go
TryPub
func (ps *PubSub) TryPub(msg interface{}, topics ...string) { ps.cmdChan <- cmd{op: tryPub, topics: topics, msg: msg} }
go
func (ps *PubSub) TryPub(msg interface{}, topics ...string) { ps.cmdChan <- cmd{op: tryPub, topics: topics, msg: msg} }
[ "func", "(", "ps", "*", "PubSub", ")", "TryPub", "(", "msg", "interface", "{", "}", ",", "topics", "...", "string", ")", "{", "ps", ".", "cmdChan", "<-", "cmd", "{", "op", ":", "tryPub", ",", "topics", ":", "topics", ",", "msg", ":", "msg", "}", ...
// TryPub publishes the given message to all subscribers of // the specified topics if the topic has buffer space.
[ "TryPub", "publishes", "the", "given", "message", "to", "all", "subscribers", "of", "the", "specified", "topics", "if", "the", "topic", "has", "buffer", "space", "." ]
65166f5ae403cbf6dcdced31e1f8f8ad95485cb3
https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L91-L93
29,923
cskr/pubsub
pubsub.go
Unsub
func (ps *PubSub) Unsub(ch chan interface{}, topics ...string) { if len(topics) == 0 { ps.cmdChan <- cmd{op: unsubAll, ch: ch} return } ps.cmdChan <- cmd{op: unsub, topics: topics, ch: ch} }
go
func (ps *PubSub) Unsub(ch chan interface{}, topics ...string) { if len(topics) == 0 { ps.cmdChan <- cmd{op: unsubAll, ch: ch} return } ps.cmdChan <- cmd{op: unsub, topics: topics, ch: ch} }
[ "func", "(", "ps", "*", "PubSub", ")", "Unsub", "(", "ch", "chan", "interface", "{", "}", ",", "topics", "...", "string", ")", "{", "if", "len", "(", "topics", ")", "==", "0", "{", "ps", ".", "cmdChan", "<-", "cmd", "{", "op", ":", "unsubAll", ...
// Unsub unsubscribes the given channel from the specified // topics. If no topic is specified, it is unsubscribed // from all topics. // // Unsub must be called from a goroutine that is different from the subscriber. // The subscriber must consume messages from the channel until it reaches the // end. Not doing so can...
[ "Unsub", "unsubscribes", "the", "given", "channel", "from", "the", "specified", "topics", ".", "If", "no", "topic", "is", "specified", "it", "is", "unsubscribed", "from", "all", "topics", ".", "Unsub", "must", "be", "called", "from", "a", "goroutine", "that"...
65166f5ae403cbf6dcdced31e1f8f8ad95485cb3
https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L102-L109
29,924
cskr/pubsub
pubsub.go
Close
func (ps *PubSub) Close(topics ...string) { ps.cmdChan <- cmd{op: closeTopic, topics: topics} }
go
func (ps *PubSub) Close(topics ...string) { ps.cmdChan <- cmd{op: closeTopic, topics: topics} }
[ "func", "(", "ps", "*", "PubSub", ")", "Close", "(", "topics", "...", "string", ")", "{", "ps", ".", "cmdChan", "<-", "cmd", "{", "op", ":", "closeTopic", ",", "topics", ":", "topics", "}", "\n", "}" ]
// Close closes all channels currently subscribed to the specified topics. // If a channel is subscribed to multiple topics, some of which is // not specified, it is not closed.
[ "Close", "closes", "all", "channels", "currently", "subscribed", "to", "the", "specified", "topics", ".", "If", "a", "channel", "is", "subscribed", "to", "multiple", "topics", "some", "of", "which", "is", "not", "specified", "it", "is", "not", "closed", "." ...
65166f5ae403cbf6dcdced31e1f8f8ad95485cb3
https://github.com/cskr/pubsub/blob/65166f5ae403cbf6dcdced31e1f8f8ad95485cb3/pubsub.go#L114-L116
29,925
gosuri/uiprogress
progress.go
New
func New() *Progress { lw := uilive.New() lw.Out = Out return &Progress{ Width: Width, Out: Out, Bars: make([]*Bar, 0), RefreshInterval: RefreshInterval, tdone: make(chan bool), lw: uilive.New(), mtx: &sync.RWMutex{}, } }
go
func New() *Progress { lw := uilive.New() lw.Out = Out return &Progress{ Width: Width, Out: Out, Bars: make([]*Bar, 0), RefreshInterval: RefreshInterval, tdone: make(chan bool), lw: uilive.New(), mtx: &sync.RWMutex{}, } }
[ "func", "New", "(", ")", "*", "Progress", "{", "lw", ":=", "uilive", ".", "New", "(", ")", "\n", "lw", ".", "Out", "=", "Out", "\n\n", "return", "&", "Progress", "{", "Width", ":", "Width", ",", "Out", ":", "Out", ",", "Bars", ":", "make", "(",...
// New returns a new progress bar with defaults
[ "New", "returns", "a", "new", "progress", "bar", "with", "defaults" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/progress.go#L43-L57
29,926
gosuri/uiprogress
progress.go
AddBar
func (p *Progress) AddBar(total int) *Bar { p.mtx.Lock() defer p.mtx.Unlock() bar := NewBar(total) bar.Width = p.Width p.Bars = append(p.Bars, bar) return bar }
go
func (p *Progress) AddBar(total int) *Bar { p.mtx.Lock() defer p.mtx.Unlock() bar := NewBar(total) bar.Width = p.Width p.Bars = append(p.Bars, bar) return bar }
[ "func", "(", "p", "*", "Progress", ")", "AddBar", "(", "total", "int", ")", "*", "Bar", "{", "p", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "bar", ":=", "NewBar", "(", "total", ")", "\...
// AddBar creates a new progress bar and adds to the container
[ "AddBar", "creates", "a", "new", "progress", "bar", "and", "adds", "to", "the", "container" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/progress.go#L94-L102
29,927
gosuri/uiprogress
progress.go
Listen
func (p *Progress) Listen() { for { p.mtx.Lock() interval := p.RefreshInterval p.mtx.Unlock() select { case <-time.After(interval): p.print() case <-p.tdone: p.print() close(p.tdone) return } } }
go
func (p *Progress) Listen() { for { p.mtx.Lock() interval := p.RefreshInterval p.mtx.Unlock() select { case <-time.After(interval): p.print() case <-p.tdone: p.print() close(p.tdone) return } } }
[ "func", "(", "p", "*", "Progress", ")", "Listen", "(", ")", "{", "for", "{", "p", ".", "mtx", ".", "Lock", "(", ")", "\n", "interval", ":=", "p", ".", "RefreshInterval", "\n", "p", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "select", "{", "ca...
// Listen listens for updates and renders the progress bars
[ "Listen", "listens", "for", "updates", "and", "renders", "the", "progress", "bars" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/progress.go#L105-L121
29,928
gosuri/uiprogress
bar.go
NewBar
func NewBar(total int) *Bar { return &Bar{ Total: total, Width: Width, LeftEnd: LeftEnd, RightEnd: RightEnd, Head: Head, Fill: Fill, Empty: Empty, mtx: &sync.RWMutex{}, } }
go
func NewBar(total int) *Bar { return &Bar{ Total: total, Width: Width, LeftEnd: LeftEnd, RightEnd: RightEnd, Head: Head, Fill: Fill, Empty: Empty, mtx: &sync.RWMutex{}, } }
[ "func", "NewBar", "(", "total", "int", ")", "*", "Bar", "{", "return", "&", "Bar", "{", "Total", ":", "total", ",", "Width", ":", "Width", ",", "LeftEnd", ":", "LeftEnd", ",", "RightEnd", ":", "RightEnd", ",", "Head", ":", "Head", ",", "Fill", ":",...
// NewBar returns a new progress bar
[ "NewBar", "returns", "a", "new", "progress", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L76-L88
29,929
gosuri/uiprogress
bar.go
Set
func (b *Bar) Set(n int) error { b.mtx.Lock() defer b.mtx.Unlock() if n > b.Total { return ErrMaxCurrentReached } b.current = n return nil }
go
func (b *Bar) Set(n int) error { b.mtx.Lock() defer b.mtx.Unlock() if n > b.Total { return ErrMaxCurrentReached } b.current = n return nil }
[ "func", "(", "b", "*", "Bar", ")", "Set", "(", "n", "int", ")", "error", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "if", "n", ">", "b", ".", "Total", "{", "return", "ErrMax...
// Set the current count of the bar. It returns ErrMaxCurrentReached when trying n exceeds the total value. This is atomic operation and concurancy safe.
[ "Set", "the", "current", "count", "of", "the", "bar", ".", "It", "returns", "ErrMaxCurrentReached", "when", "trying", "n", "exceeds", "the", "total", "value", ".", "This", "is", "atomic", "operation", "and", "concurancy", "safe", "." ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L91-L100
29,930
gosuri/uiprogress
bar.go
Incr
func (b *Bar) Incr() bool { b.mtx.Lock() defer b.mtx.Unlock() n := b.current + 1 if n > b.Total { return false } var t time.Time if b.TimeStarted == t { b.TimeStarted = time.Now() } b.timeElapsed = time.Since(b.TimeStarted) b.current = n return true }
go
func (b *Bar) Incr() bool { b.mtx.Lock() defer b.mtx.Unlock() n := b.current + 1 if n > b.Total { return false } var t time.Time if b.TimeStarted == t { b.TimeStarted = time.Now() } b.timeElapsed = time.Since(b.TimeStarted) b.current = n return true }
[ "func", "(", "b", "*", "Bar", ")", "Incr", "(", ")", "bool", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "n", ":=", "b", ".", "current", "+", "1", "\n", "if", "n", ">", "b"...
// Incr increments the current value by 1, time elapsed to current time and returns true. It returns false if the cursor has reached or exceeds total value.
[ "Incr", "increments", "the", "current", "value", "by", "1", "time", "elapsed", "to", "current", "time", "and", "returns", "true", ".", "It", "returns", "false", "if", "the", "cursor", "has", "reached", "or", "exceeds", "total", "value", "." ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L103-L118
29,931
gosuri/uiprogress
bar.go
Current
func (b *Bar) Current() int { b.mtx.RLock() defer b.mtx.RUnlock() return b.current }
go
func (b *Bar) Current() int { b.mtx.RLock() defer b.mtx.RUnlock() return b.current }
[ "func", "(", "b", "*", "Bar", ")", "Current", "(", ")", "int", "{", "b", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "b", ".", "current", "\n", "}" ]
// Current returns the current progress of the bar
[ "Current", "returns", "the", "current", "progress", "of", "the", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L121-L125
29,932
gosuri/uiprogress
bar.go
AppendFunc
func (b *Bar) AppendFunc(f DecoratorFunc) *Bar { b.mtx.Lock() defer b.mtx.Unlock() b.appendFuncs = append(b.appendFuncs, f) return b }
go
func (b *Bar) AppendFunc(f DecoratorFunc) *Bar { b.mtx.Lock() defer b.mtx.Unlock() b.appendFuncs = append(b.appendFuncs, f) return b }
[ "func", "(", "b", "*", "Bar", ")", "AppendFunc", "(", "f", "DecoratorFunc", ")", "*", "Bar", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n", "b", ".", "appendFuncs", "=", "append", "("...
// AppendFunc runs the decorator function and renders the output on the right of the progress bar
[ "AppendFunc", "runs", "the", "decorator", "function", "and", "renders", "the", "output", "on", "the", "right", "of", "the", "progress", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L128-L133
29,933
gosuri/uiprogress
bar.go
AppendCompleted
func (b *Bar) AppendCompleted() *Bar { b.AppendFunc(func(b *Bar) string { return b.CompletedPercentString() }) return b }
go
func (b *Bar) AppendCompleted() *Bar { b.AppendFunc(func(b *Bar) string { return b.CompletedPercentString() }) return b }
[ "func", "(", "b", "*", "Bar", ")", "AppendCompleted", "(", ")", "*", "Bar", "{", "b", ".", "AppendFunc", "(", "func", "(", "b", "*", "Bar", ")", "string", "{", "return", "b", ".", "CompletedPercentString", "(", ")", "\n", "}", ")", "\n", "return", ...
// AppendCompleted appends the completion percent to the progress bar
[ "AppendCompleted", "appends", "the", "completion", "percent", "to", "the", "progress", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L136-L141
29,934
gosuri/uiprogress
bar.go
AppendElapsed
func (b *Bar) AppendElapsed() *Bar { b.AppendFunc(func(b *Bar) string { return strutil.PadLeft(b.TimeElapsedString(), 5, ' ') }) return b }
go
func (b *Bar) AppendElapsed() *Bar { b.AppendFunc(func(b *Bar) string { return strutil.PadLeft(b.TimeElapsedString(), 5, ' ') }) return b }
[ "func", "(", "b", "*", "Bar", ")", "AppendElapsed", "(", ")", "*", "Bar", "{", "b", ".", "AppendFunc", "(", "func", "(", "b", "*", "Bar", ")", "string", "{", "return", "strutil", ".", "PadLeft", "(", "b", ".", "TimeElapsedString", "(", ")", ",", ...
// AppendElapsed appends the time elapsed the be progress bar
[ "AppendElapsed", "appends", "the", "time", "elapsed", "the", "be", "progress", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L144-L149
29,935
gosuri/uiprogress
bar.go
PrependFunc
func (b *Bar) PrependFunc(f DecoratorFunc) *Bar { b.mtx.Lock() defer b.mtx.Unlock() b.prependFuncs = append(b.prependFuncs, f) return b }
go
func (b *Bar) PrependFunc(f DecoratorFunc) *Bar { b.mtx.Lock() defer b.mtx.Unlock() b.prependFuncs = append(b.prependFuncs, f) return b }
[ "func", "(", "b", "*", "Bar", ")", "PrependFunc", "(", "f", "DecoratorFunc", ")", "*", "Bar", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n", "b", ".", "prependFuncs", "=", "append", "...
// PrependFunc runs decorator function and render the output left the progress bar
[ "PrependFunc", "runs", "decorator", "function", "and", "render", "the", "output", "left", "the", "progress", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L152-L157
29,936
gosuri/uiprogress
bar.go
PrependCompleted
func (b *Bar) PrependCompleted() *Bar { b.PrependFunc(func(b *Bar) string { return b.CompletedPercentString() }) return b }
go
func (b *Bar) PrependCompleted() *Bar { b.PrependFunc(func(b *Bar) string { return b.CompletedPercentString() }) return b }
[ "func", "(", "b", "*", "Bar", ")", "PrependCompleted", "(", ")", "*", "Bar", "{", "b", ".", "PrependFunc", "(", "func", "(", "b", "*", "Bar", ")", "string", "{", "return", "b", ".", "CompletedPercentString", "(", ")", "\n", "}", ")", "\n", "return"...
// PrependCompleted prepends the precent completed to the progress bar
[ "PrependCompleted", "prepends", "the", "precent", "completed", "to", "the", "progress", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L160-L165
29,937
gosuri/uiprogress
bar.go
PrependElapsed
func (b *Bar) PrependElapsed() *Bar { b.PrependFunc(func(b *Bar) string { return strutil.PadLeft(b.TimeElapsedString(), 5, ' ') }) return b }
go
func (b *Bar) PrependElapsed() *Bar { b.PrependFunc(func(b *Bar) string { return strutil.PadLeft(b.TimeElapsedString(), 5, ' ') }) return b }
[ "func", "(", "b", "*", "Bar", ")", "PrependElapsed", "(", ")", "*", "Bar", "{", "b", ".", "PrependFunc", "(", "func", "(", "b", "*", "Bar", ")", "string", "{", "return", "strutil", ".", "PadLeft", "(", "b", ".", "TimeElapsedString", "(", ")", ",", ...
// PrependElapsed prepends the time elapsed to the begining of the bar
[ "PrependElapsed", "prepends", "the", "time", "elapsed", "to", "the", "begining", "of", "the", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L168-L173
29,938
gosuri/uiprogress
bar.go
Bytes
func (b *Bar) Bytes() []byte { completedWidth := int(float64(b.Width) * (b.CompletedPercent() / 100.00)) // add fill and empty bits var buf bytes.Buffer for i := 0; i < completedWidth; i++ { buf.WriteByte(b.Fill) } for i := 0; i < b.Width-completedWidth; i++ { buf.WriteByte(b.Empty) } // set head bit pb ...
go
func (b *Bar) Bytes() []byte { completedWidth := int(float64(b.Width) * (b.CompletedPercent() / 100.00)) // add fill and empty bits var buf bytes.Buffer for i := 0; i < completedWidth; i++ { buf.WriteByte(b.Fill) } for i := 0; i < b.Width-completedWidth; i++ { buf.WriteByte(b.Empty) } // set head bit pb ...
[ "func", "(", "b", "*", "Bar", ")", "Bytes", "(", ")", "[", "]", "byte", "{", "completedWidth", ":=", "int", "(", "float64", "(", "b", ".", "Width", ")", "*", "(", "b", ".", "CompletedPercent", "(", ")", "/", "100.00", ")", ")", "\n\n", "// add fi...
// Bytes returns the byte presentation of the progress bar
[ "Bytes", "returns", "the", "byte", "presentation", "of", "the", "progress", "bar" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L176-L210
29,939
gosuri/uiprogress
bar.go
CompletedPercent
func (b *Bar) CompletedPercent() float64 { return (float64(b.Current()) / float64(b.Total)) * 100.00 }
go
func (b *Bar) CompletedPercent() float64 { return (float64(b.Current()) / float64(b.Total)) * 100.00 }
[ "func", "(", "b", "*", "Bar", ")", "CompletedPercent", "(", ")", "float64", "{", "return", "(", "float64", "(", "b", ".", "Current", "(", ")", ")", "/", "float64", "(", "b", ".", "Total", ")", ")", "*", "100.00", "\n", "}" ]
// CompletedPercent return the percent completed
[ "CompletedPercent", "return", "the", "percent", "completed" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L218-L220
29,940
gosuri/uiprogress
bar.go
TimeElapsed
func (b *Bar) TimeElapsed() time.Duration { b.mtx.RLock() defer b.mtx.RUnlock() return b.timeElapsed }
go
func (b *Bar) TimeElapsed() time.Duration { b.mtx.RLock() defer b.mtx.RUnlock() return b.timeElapsed }
[ "func", "(", "b", "*", "Bar", ")", "TimeElapsed", "(", ")", "time", ".", "Duration", "{", "b", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "b", ".", "timeElapsed", "\n", "}" ]
// TimeElapsed returns the time elapsed
[ "TimeElapsed", "returns", "the", "time", "elapsed" ]
d0567a9d84a1c40dd7568115ea66f4887bf57b33
https://github.com/gosuri/uiprogress/blob/d0567a9d84a1c40dd7568115ea66f4887bf57b33/bar.go#L228-L232
29,941
goreleaser/nfpm
glob/glob.go
longestCommonPrefix
func longestCommonPrefix(strs []string) string { if len(strs) == 0 { return "" } lcp := strs[0] for _, str := range strs { lcp = strlcp(lcp, str) } return lcp }
go
func longestCommonPrefix(strs []string) string { if len(strs) == 0 { return "" } lcp := strs[0] for _, str := range strs { lcp = strlcp(lcp, str) } return lcp }
[ "func", "longestCommonPrefix", "(", "strs", "[", "]", "string", ")", "string", "{", "if", "len", "(", "strs", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "lcp", ":=", "strs", "[", "0", "]", "\n", "for", "_", ",", "str", ":=", "r...
// longestCommonPrefix returns the longest prefix of all strings the argument // slice. If the slice is empty the empty string is returned
[ "longestCommonPrefix", "returns", "the", "longest", "prefix", "of", "all", "strings", "the", "argument", "slice", ".", "If", "the", "slice", "is", "empty", "the", "empty", "string", "is", "returned" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/glob/glob.go#L15-L24
29,942
goreleaser/nfpm
deb/deb.go
Package
func (*Deb) Package(info nfpm.Info, deb io.Writer) (err error) { arch, ok := archToDebian[info.Arch] if ok { info.Arch = arch } dataTarGz, md5sums, instSize, err := createDataTarGz(info) if err != nil { return err } controlTarGz, err := createControl(instSize, md5sums, info) if err != nil { return err } ...
go
func (*Deb) Package(info nfpm.Info, deb io.Writer) (err error) { arch, ok := archToDebian[info.Arch] if ok { info.Arch = arch } dataTarGz, md5sums, instSize, err := createDataTarGz(info) if err != nil { return err } controlTarGz, err := createControl(instSize, md5sums, info) if err != nil { return err } ...
[ "func", "(", "*", "Deb", ")", "Package", "(", "info", "nfpm", ".", "Info", ",", "deb", "io", ".", "Writer", ")", "(", "err", "error", ")", "{", "arch", ",", "ok", ":=", "archToDebian", "[", "info", ".", "Arch", "]", "\n", "if", "ok", "{", "info...
// Package writes a new deb package to the given writer using the given info
[ "Package", "writes", "a", "new", "deb", "package", "to", "the", "given", "writer", "using", "the", "given", "info" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/deb/deb.go#L47-L74
29,943
goreleaser/nfpm
deb/deb.go
createTree
func createTree(tarw *tar.Writer, dst string, created map[string]bool) error { for _, path := range pathsToCreate(dst) { if created[path] { // skipping dir that was previously created inside the archive // (eg: usr/) continue } if err := tarw.WriteHeader(&tar.Header{ Name: filepath.ToSlash(path +...
go
func createTree(tarw *tar.Writer, dst string, created map[string]bool) error { for _, path := range pathsToCreate(dst) { if created[path] { // skipping dir that was previously created inside the archive // (eg: usr/) continue } if err := tarw.WriteHeader(&tar.Header{ Name: filepath.ToSlash(path +...
[ "func", "createTree", "(", "tarw", "*", "tar", ".", "Writer", ",", "dst", "string", ",", "created", "map", "[", "string", "]", "bool", ")", "error", "{", "for", "_", ",", "path", ":=", "range", "pathsToCreate", "(", "dst", ")", "{", "if", "created", ...
// this is needed because the data.tar.gz file should have the empty folders // as well, so we walk through the dst and create all subfolders.
[ "this", "is", "needed", "because", "the", "data", ".", "tar", ".", "gz", "file", "should", "have", "the", "empty", "folders", "as", "well", "so", "we", "walk", "through", "the", "dst", "and", "create", "all", "subfolders", "." ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/deb/deb.go#L285-L304
29,944
goreleaser/nfpm
rpm/rpm.go
Package
func (*RPM) Package(info nfpm.Info, w io.Writer) error { arch, ok := archToRPM[info.Arch] if ok { info.Arch = arch } info.Version = strings.Replace(info.Version, "-", "_", -1) _, err := exec.LookPath("rpmbuild") if err != nil { return fmt.Errorf("rpmbuild not present in $PATH") } temps, err := setupTempFile...
go
func (*RPM) Package(info nfpm.Info, w io.Writer) error { arch, ok := archToRPM[info.Arch] if ok { info.Arch = arch } info.Version = strings.Replace(info.Version, "-", "_", -1) _, err := exec.LookPath("rpmbuild") if err != nil { return fmt.Errorf("rpmbuild not present in $PATH") } temps, err := setupTempFile...
[ "func", "(", "*", "RPM", ")", "Package", "(", "info", "nfpm", ".", "Info", ",", "w", "io", ".", "Writer", ")", "error", "{", "arch", ",", "ok", ":=", "archToRPM", "[", "info", ".", "Arch", "]", "\n", "if", "ok", "{", "info", ".", "Arch", "=", ...
// Package writes a new RPM package to the given writer using the given info
[ "Package", "writes", "a", "new", "RPM", "package", "to", "the", "given", "writer", "using", "the", "given", "info" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/rpm/rpm.go#L43-L89
29,945
goreleaser/nfpm
nfpm.go
Register
func Register(format string, p Packager) { lock.Lock() packagers[format] = p lock.Unlock() }
go
func Register(format string, p Packager) { lock.Lock() packagers[format] = p lock.Unlock() }
[ "func", "Register", "(", "format", "string", ",", "p", "Packager", ")", "{", "lock", ".", "Lock", "(", ")", "\n", "packagers", "[", "format", "]", "=", "p", "\n", "lock", ".", "Unlock", "(", ")", "\n", "}" ]
// Register a new packager for the given format
[ "Register", "a", "new", "packager", "for", "the", "given", "format" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L24-L28
29,946
goreleaser/nfpm
nfpm.go
Get
func Get(format string) (Packager, error) { p, ok := packagers[format] if !ok { return nil, fmt.Errorf("no packager registered for the format %s", format) } return p, nil }
go
func Get(format string) (Packager, error) { p, ok := packagers[format] if !ok { return nil, fmt.Errorf("no packager registered for the format %s", format) } return p, nil }
[ "func", "Get", "(", "format", "string", ")", "(", "Packager", ",", "error", ")", "{", "p", ",", "ok", ":=", "packagers", "[", "format", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "format", ...
// Get a packager for the given format
[ "Get", "a", "packager", "for", "the", "given", "format" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L31-L37
29,947
goreleaser/nfpm
nfpm.go
Parse
func Parse(in io.Reader) (config Config, err error) { dec := yaml.NewDecoder(in) dec.SetStrict(true) if err = dec.Decode(&config); err != nil { return } config.Info.Version = os.ExpandEnv(config.Info.Version) err = config.Validate() return }
go
func Parse(in io.Reader) (config Config, err error) { dec := yaml.NewDecoder(in) dec.SetStrict(true) if err = dec.Decode(&config); err != nil { return } config.Info.Version = os.ExpandEnv(config.Info.Version) err = config.Validate() return }
[ "func", "Parse", "(", "in", "io", ".", "Reader", ")", "(", "config", "Config", ",", "err", "error", ")", "{", "dec", ":=", "yaml", ".", "NewDecoder", "(", "in", ")", "\n", "dec", ".", "SetStrict", "(", "true", ")", "\n", "if", "err", "=", "dec", ...
// Parse decodes YAML data from an io.Reader into a configuration struct
[ "Parse", "decodes", "YAML", "data", "from", "an", "io", ".", "Reader", "into", "a", "configuration", "struct" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L40-L50
29,948
goreleaser/nfpm
nfpm.go
ParseFile
func ParseFile(path string) (config Config, err error) { var file *os.File file, err = os.Open(path) //nolint:gosec if err != nil { return } defer file.Close() // nolint: errcheck return Parse(file) }
go
func ParseFile(path string) (config Config, err error) { var file *os.File file, err = os.Open(path) //nolint:gosec if err != nil { return } defer file.Close() // nolint: errcheck return Parse(file) }
[ "func", "ParseFile", "(", "path", "string", ")", "(", "config", "Config", ",", "err", "error", ")", "{", "var", "file", "*", "os", ".", "File", "\n", "file", ",", "err", "=", "os", ".", "Open", "(", "path", ")", "//nolint:gosec", "\n", "if", "err",...
// ParseFile decodes YAML data from a file path into a configuration struct
[ "ParseFile", "decodes", "YAML", "data", "from", "a", "file", "path", "into", "a", "configuration", "struct" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L53-L61
29,949
goreleaser/nfpm
nfpm.go
Get
func (c *Config) Get(format string) (info Info, err error) { // make a deep copy of info if err = mergo.Merge(&info, c.Info); err != nil { return } override, ok := c.Overrides[format] if !ok { // no overrides return } err = mergo.Merge(&info.Overridables, override, mergo.WithOverride) if err != nil { re...
go
func (c *Config) Get(format string) (info Info, err error) { // make a deep copy of info if err = mergo.Merge(&info, c.Info); err != nil { return } override, ok := c.Overrides[format] if !ok { // no overrides return } err = mergo.Merge(&info.Overridables, override, mergo.WithOverride) if err != nil { re...
[ "func", "(", "c", "*", "Config", ")", "Get", "(", "format", "string", ")", "(", "info", "Info", ",", "err", "error", ")", "{", "// make a deep copy of info", "if", "err", "=", "mergo", ".", "Merge", "(", "&", "info", ",", "c", ".", "Info", ")", ";"...
// Get returns the Info struct for the given packager format. Overrides // for the given format are merged into the final struct
[ "Get", "returns", "the", "Info", "struct", "for", "the", "given", "packager", "format", ".", "Overrides", "for", "the", "given", "format", "are", "merged", "into", "the", "final", "struct" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L76-L91
29,950
goreleaser/nfpm
nfpm.go
Validate
func (c *Config) Validate() error { for format := range c.Overrides { if _, err := Get(format); err != nil { return err } } return nil }
go
func (c *Config) Validate() error { for format := range c.Overrides { if _, err := Get(format); err != nil { return err } } return nil }
[ "func", "(", "c", "*", "Config", ")", "Validate", "(", ")", "error", "{", "for", "format", ":=", "range", "c", ".", "Overrides", "{", "if", "_", ",", "err", ":=", "Get", "(", "format", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "...
// Validate ensures that the config is well typed
[ "Validate", "ensures", "that", "the", "config", "is", "well", "typed" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L94-L101
29,951
goreleaser/nfpm
nfpm.go
Validate
func Validate(info Info) error { if info.Name == "" { return fmt.Errorf("package name cannot be empty") } if info.Arch == "" { return fmt.Errorf("package arch must be provided") } if info.Version == "" { return fmt.Errorf("package version must be provided") } if len(info.Files)+len(info.ConfigFiles) == 0 {...
go
func Validate(info Info) error { if info.Name == "" { return fmt.Errorf("package name cannot be empty") } if info.Arch == "" { return fmt.Errorf("package arch must be provided") } if info.Version == "" { return fmt.Errorf("package version must be provided") } if len(info.Files)+len(info.ConfigFiles) == 0 {...
[ "func", "Validate", "(", "info", "Info", ")", "error", "{", "if", "info", ".", "Name", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "info", ".", "Arch", "==", "\"", "\"", "{", "return", "fm...
// Validate the given Info and returns an error if it is invalid.
[ "Validate", "the", "given", "Info", "and", "returns", "an", "error", "if", "it", "is", "invalid", "." ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L143-L157
29,952
goreleaser/nfpm
nfpm.go
WithDefaults
func WithDefaults(info Info) Info { if info.Bindir == "" { info.Bindir = "/usr/local/bin" } if info.Platform == "" { info.Platform = "linux" } if info.Description == "" { info.Description = "no description given" } info.Version = strings.TrimPrefix(info.Version, "v") return info }
go
func WithDefaults(info Info) Info { if info.Bindir == "" { info.Bindir = "/usr/local/bin" } if info.Platform == "" { info.Platform = "linux" } if info.Description == "" { info.Description = "no description given" } info.Version = strings.TrimPrefix(info.Version, "v") return info }
[ "func", "WithDefaults", "(", "info", "Info", ")", "Info", "{", "if", "info", ".", "Bindir", "==", "\"", "\"", "{", "info", ".", "Bindir", "=", "\"", "\"", "\n", "}", "\n", "if", "info", ".", "Platform", "==", "\"", "\"", "{", "info", ".", "Platfo...
// WithDefaults set some sane defaults into the given Info
[ "WithDefaults", "set", "some", "sane", "defaults", "into", "the", "given", "Info" ]
21aa86065385f2c769cb56f151344d46e8c6c5da
https://github.com/goreleaser/nfpm/blob/21aa86065385f2c769cb56f151344d46e8c6c5da/nfpm.go#L160-L172
29,953
tsuna/gohbase
region/client.go
QueueRPC
func (c *client) QueueRPC(rpc hrpc.Call) { if b, ok := rpc.(hrpc.Batchable); ok && c.rpcQueueSize > 1 && !b.SkipBatch() { // queue up the rpc select { case <-rpc.Context().Done(): // rpc timed out before being processed case <-c.done: returnResult(rpc, nil, ErrClientClosed) case c.rpcs <- rpc: } } e...
go
func (c *client) QueueRPC(rpc hrpc.Call) { if b, ok := rpc.(hrpc.Batchable); ok && c.rpcQueueSize > 1 && !b.SkipBatch() { // queue up the rpc select { case <-rpc.Context().Done(): // rpc timed out before being processed case <-c.done: returnResult(rpc, nil, ErrClientClosed) case c.rpcs <- rpc: } } e...
[ "func", "(", "c", "*", "client", ")", "QueueRPC", "(", "rpc", "hrpc", ".", "Call", ")", "{", "if", "b", ",", "ok", ":=", "rpc", ".", "(", "hrpc", ".", "Batchable", ")", ";", "ok", "&&", "c", ".", "rpcQueueSize", ">", "1", "&&", "!", "b", ".",...
// QueueRPC will add an rpc call to the queue for processing by the writer goroutine
[ "QueueRPC", "will", "add", "an", "rpc", "call", "to", "the", "queue", "for", "processing", "by", "the", "writer", "goroutine" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L180-L195
29,954
tsuna/gohbase
region/client.go
write
func (c *client) write(buf []byte) error { _, err := c.conn.Write(buf) return err }
go
func (c *client) write(buf []byte) error { _, err := c.conn.Write(buf) return err }
[ "func", "(", "c", "*", "client", ")", "write", "(", "buf", "[", "]", "byte", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "conn", ".", "Write", "(", "buf", ")", "\n", "return", "err", "\n", "}" ]
// write sends the given buffer to the RegionServer.
[ "write", "sends", "the", "given", "buffer", "to", "the", "RegionServer", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L519-L522
29,955
tsuna/gohbase
region/client.go
readFully
func (c *client) readFully(buf []byte) error { _, err := io.ReadFull(c.conn, buf) return err }
go
func (c *client) readFully(buf []byte) error { _, err := io.ReadFull(c.conn, buf) return err }
[ "func", "(", "c", "*", "client", ")", "readFully", "(", "buf", "[", "]", "byte", ")", "error", "{", "_", ",", "err", ":=", "io", ".", "ReadFull", "(", "c", ".", "conn", ",", "buf", ")", "\n", "return", "err", "\n", "}" ]
// Tries to read enough data to fully fill up the given buffer.
[ "Tries", "to", "read", "enough", "data", "to", "fully", "fill", "up", "the", "given", "buffer", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L525-L528
29,956
tsuna/gohbase
region/client.go
sendHello
func (c *client) sendHello(ctype ClientType) error { connHeader := &pb.ConnectionHeader{ UserInfo: &pb.UserInformation{ EffectiveUser: proto.String(c.effectiveUser), }, ServiceName: proto.String(string(ctype)), CellBlockCodecClass: proto.String("org.apache.hadoop.hbase.codec.KeyValueCodec"), } dat...
go
func (c *client) sendHello(ctype ClientType) error { connHeader := &pb.ConnectionHeader{ UserInfo: &pb.UserInformation{ EffectiveUser: proto.String(c.effectiveUser), }, ServiceName: proto.String(string(ctype)), CellBlockCodecClass: proto.String("org.apache.hadoop.hbase.codec.KeyValueCodec"), } dat...
[ "func", "(", "c", "*", "client", ")", "sendHello", "(", "ctype", "ClientType", ")", "error", "{", "connHeader", ":=", "&", "pb", ".", "ConnectionHeader", "{", "UserInfo", ":", "&", "pb", ".", "UserInformation", "{", "EffectiveUser", ":", "proto", ".", "S...
// sendHello sends the "hello" message needed when opening a new connection.
[ "sendHello", "sends", "the", "hello", "message", "needed", "when", "opening", "a", "new", "connection", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/client.go#L531-L551
29,957
tsuna/gohbase
region/multi.go
ToProto
func (m *multi) ToProto() proto.Message { // aggregate calls per region actionsPerReg := map[hrpc.RegionInfo][]*pb.Action{} for i, c := range m.calls { select { case <-c.Context().Done(): // context has expired, don't bother sending it m.calls[i] = nil continue default: } msg := c.ToProto() a...
go
func (m *multi) ToProto() proto.Message { // aggregate calls per region actionsPerReg := map[hrpc.RegionInfo][]*pb.Action{} for i, c := range m.calls { select { case <-c.Context().Done(): // context has expired, don't bother sending it m.calls[i] = nil continue default: } msg := c.ToProto() a...
[ "func", "(", "m", "*", "multi", ")", "ToProto", "(", ")", "proto", ".", "Message", "{", "// aggregate calls per region", "actionsPerReg", ":=", "map", "[", "hrpc", ".", "RegionInfo", "]", "[", "]", "*", "pb", ".", "Action", "{", "}", "\n\n", "for", "i"...
// ToProto converts all request in multi batch to a protobuf message.
[ "ToProto", "converts", "all", "request", "in", "multi", "batch", "to", "a", "protobuf", "message", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/multi.go#L51-L101
29,958
tsuna/gohbase
region/multi.go
DeserializeCellBlocks
func (m *multi) DeserializeCellBlocks(msg proto.Message, b []byte) (uint32, error) { mr := msg.(*pb.MultiResponse) var nread uint32 for _, rar := range mr.GetRegionActionResult() { if e := rar.GetException(); e != nil { if l := len(rar.GetResultOrException()); l != 0 { return 0, fmt.Errorf( "got excep...
go
func (m *multi) DeserializeCellBlocks(msg proto.Message, b []byte) (uint32, error) { mr := msg.(*pb.MultiResponse) var nread uint32 for _, rar := range mr.GetRegionActionResult() { if e := rar.GetException(); e != nil { if l := len(rar.GetResultOrException()); l != 0 { return 0, fmt.Errorf( "got excep...
[ "func", "(", "m", "*", "multi", ")", "DeserializeCellBlocks", "(", "msg", "proto", ".", "Message", ",", "b", "[", "]", "byte", ")", "(", "uint32", ",", "error", ")", "{", "mr", ":=", "msg", ".", "(", "*", "pb", ".", "MultiResponse", ")", "\n\n", ...
// DeserializeCellBlocks deserializes action results from cell blocks.
[ "DeserializeCellBlocks", "deserializes", "action", "results", "from", "cell", "blocks", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/multi.go#L109-L161
29,959
tsuna/gohbase
region/multi.go
add
func (m *multi) add(call hrpc.Call) bool { m.calls = append(m.calls, call) return len(m.calls) == m.size }
go
func (m *multi) add(call hrpc.Call) bool { m.calls = append(m.calls, call) return len(m.calls) == m.size }
[ "func", "(", "m", "*", "multi", ")", "add", "(", "call", "hrpc", ".", "Call", ")", "bool", "{", "m", ".", "calls", "=", "append", "(", "m", ".", "calls", ",", "call", ")", "\n", "return", "len", "(", "m", ".", "calls", ")", "==", "m", ".", ...
// add adds the call and returns wether the batch is full.
[ "add", "adds", "the", "call", "and", "returns", "wether", "the", "batch", "is", "full", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/multi.go#L230-L233
29,960
tsuna/gohbase
region/multi.go
get
func (m *multi) get(i uint32) hrpc.Call { if i == 0 { panic("index cannot be 0") } return m.calls[i-1] }
go
func (m *multi) get(i uint32) hrpc.Call { if i == 0 { panic("index cannot be 0") } return m.calls[i-1] }
[ "func", "(", "m", "*", "multi", ")", "get", "(", "i", "uint32", ")", "hrpc", ".", "Call", "{", "if", "i", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "m", ".", "calls", "[", "i", "-", "1", "]", "\n", "}" ]
// get retruns an rpc at index. Indicies start from 1 since 0 means that // region server didn't set an index for the action result.
[ "get", "retruns", "an", "rpc", "at", "index", ".", "Indicies", "start", "from", "1", "since", "0", "means", "that", "region", "server", "didn", "t", "set", "an", "index", "for", "the", "action", "result", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/multi.go#L242-L247
29,961
tsuna/gohbase
region/info.go
NewInfo
func NewInfo(id uint64, namespace, table, name, startKey, stopKey []byte) hrpc.RegionInfo { ctx, cancel := context.WithCancel(context.Background()) return &info{ id: id, ctx: ctx, cancel: cancel, namespace: namespace, table: table, name: name, startKey: startKey, stopKey: s...
go
func NewInfo(id uint64, namespace, table, name, startKey, stopKey []byte) hrpc.RegionInfo { ctx, cancel := context.WithCancel(context.Background()) return &info{ id: id, ctx: ctx, cancel: cancel, namespace: namespace, table: table, name: name, startKey: startKey, stopKey: s...
[ "func", "NewInfo", "(", "id", "uint64", ",", "namespace", ",", "table", ",", "name", ",", "startKey", ",", "stopKey", "[", "]", "byte", ")", "hrpc", ".", "RegionInfo", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "context", ".", ...
// NewInfo creates a new region info
[ "NewInfo", "creates", "a", "new", "region", "info" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L58-L70
29,962
tsuna/gohbase
region/info.go
infoFromCell
func infoFromCell(cell *hrpc.Cell) (hrpc.RegionInfo, error) { value := cell.Value if len(value) == 0 { return nil, fmt.Errorf("empty value in %q", cell) } else if value[0] != 'P' { return nil, fmt.Errorf("unsupported region info version %d in %q", value[0], cell) } const pbufMagic = 1346524486 // 4 bytes: "PBU...
go
func infoFromCell(cell *hrpc.Cell) (hrpc.RegionInfo, error) { value := cell.Value if len(value) == 0 { return nil, fmt.Errorf("empty value in %q", cell) } else if value[0] != 'P' { return nil, fmt.Errorf("unsupported region info version %d in %q", value[0], cell) } const pbufMagic = 1346524486 // 4 bytes: "PBU...
[ "func", "infoFromCell", "(", "cell", "*", "hrpc", ".", "Cell", ")", "(", "hrpc", ".", "RegionInfo", ",", "error", ")", "{", "value", ":=", "cell", ".", "Value", "\n", "if", "len", "(", "value", ")", "==", "0", "{", "return", "nil", ",", "fmt", "....
// infoFromCell parses a KeyValue from the meta table and creates the // corresponding Info object.
[ "infoFromCell", "parses", "a", "KeyValue", "from", "the", "meta", "table", "and", "creates", "the", "corresponding", "Info", "object", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L74-L108
29,963
tsuna/gohbase
region/info.go
IsUnavailable
func (i *info) IsUnavailable() bool { i.m.RLock() res := i.available != nil i.m.RUnlock() return res }
go
func (i *info) IsUnavailable() bool { i.m.RLock() res := i.available != nil i.m.RUnlock() return res }
[ "func", "(", "i", "*", "info", ")", "IsUnavailable", "(", ")", "bool", "{", "i", ".", "m", ".", "RLock", "(", ")", "\n", "res", ":=", "i", ".", "available", "!=", "nil", "\n", "i", ".", "m", ".", "RUnlock", "(", ")", "\n", "return", "res", "\...
// IsUnavailable returns true if this region has been marked as unavailable.
[ "IsUnavailable", "returns", "true", "if", "this", "region", "has", "been", "marked", "as", "unavailable", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L150-L155
29,964
tsuna/gohbase
region/info.go
AvailabilityChan
func (i *info) AvailabilityChan() <-chan struct{} { i.m.RLock() ch := i.available i.m.RUnlock() return ch }
go
func (i *info) AvailabilityChan() <-chan struct{} { i.m.RLock() ch := i.available i.m.RUnlock() return ch }
[ "func", "(", "i", "*", "info", ")", "AvailabilityChan", "(", ")", "<-", "chan", "struct", "{", "}", "{", "i", ".", "m", ".", "RLock", "(", ")", "\n", "ch", ":=", "i", ".", "available", "\n", "i", ".", "m", ".", "RUnlock", "(", ")", "\n", "ret...
// AvailabilityChan returns a channel that can be used to wait on for // notification that a connection to this region has been reestablished. // If this region is not marked as unavailable, nil will be returned.
[ "AvailabilityChan", "returns", "a", "channel", "that", "can", "be", "used", "to", "wait", "on", "for", "notification", "that", "a", "connection", "to", "this", "region", "has", "been", "reestablished", ".", "If", "this", "region", "is", "not", "marked", "as"...
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L160-L165
29,965
tsuna/gohbase
region/info.go
MarkUnavailable
func (i *info) MarkUnavailable() bool { created := false i.m.Lock() if i.available == nil { i.available = make(chan struct{}) created = true } i.m.Unlock() return created }
go
func (i *info) MarkUnavailable() bool { created := false i.m.Lock() if i.available == nil { i.available = make(chan struct{}) created = true } i.m.Unlock() return created }
[ "func", "(", "i", "*", "info", ")", "MarkUnavailable", "(", ")", "bool", "{", "created", ":=", "false", "\n", "i", ".", "m", ".", "Lock", "(", ")", "\n", "if", "i", ".", "available", "==", "nil", "{", "i", ".", "available", "=", "make", "(", "c...
// MarkUnavailable will mark this region as unavailable, by creating the struct // returned by AvailabilityChan. If this region was marked as available // before this, true will be returned.
[ "MarkUnavailable", "will", "mark", "this", "region", "as", "unavailable", "by", "creating", "the", "struct", "returned", "by", "AvailabilityChan", ".", "If", "this", "region", "was", "marked", "as", "available", "before", "this", "true", "will", "be", "returned"...
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L170-L179
29,966
tsuna/gohbase
region/info.go
MarkAvailable
func (i *info) MarkAvailable() { i.m.Lock() ch := i.available i.available = nil close(ch) i.m.Unlock() }
go
func (i *info) MarkAvailable() { i.m.Lock() ch := i.available i.available = nil close(ch) i.m.Unlock() }
[ "func", "(", "i", "*", "info", ")", "MarkAvailable", "(", ")", "{", "i", ".", "m", ".", "Lock", "(", ")", "\n", "ch", ":=", "i", ".", "available", "\n", "i", ".", "available", "=", "nil", "\n", "close", "(", "ch", ")", "\n", "i", ".", "m", ...
// MarkAvailable will mark this region as available again, by closing the struct // returned by AvailabilityChan
[ "MarkAvailable", "will", "mark", "this", "region", "as", "available", "again", "by", "closing", "the", "struct", "returned", "by", "AvailabilityChan" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L183-L189
29,967
tsuna/gohbase
region/info.go
Client
func (i *info) Client() hrpc.RegionClient { i.m.RLock() c := i.client i.m.RUnlock() return c }
go
func (i *info) Client() hrpc.RegionClient { i.m.RLock() c := i.client i.m.RUnlock() return c }
[ "func", "(", "i", "*", "info", ")", "Client", "(", ")", "hrpc", ".", "RegionClient", "{", "i", ".", "m", ".", "RLock", "(", ")", "\n", "c", ":=", "i", ".", "client", "\n", "i", ".", "m", ".", "RUnlock", "(", ")", "\n", "return", "c", "\n", ...
// Client returns region client
[ "Client", "returns", "region", "client" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L239-L244
29,968
tsuna/gohbase
region/info.go
SetClient
func (i *info) SetClient(c hrpc.RegionClient) { i.m.Lock() i.client = c i.m.Unlock() }
go
func (i *info) SetClient(c hrpc.RegionClient) { i.m.Lock() i.client = c i.m.Unlock() }
[ "func", "(", "i", "*", "info", ")", "SetClient", "(", "c", "hrpc", ".", "RegionClient", ")", "{", "i", ".", "m", ".", "Lock", "(", ")", "\n", "i", ".", "client", "=", "c", "\n", "i", ".", "m", ".", "Unlock", "(", ")", "\n", "}" ]
// SetClient sets region client
[ "SetClient", "sets", "region", "client" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/region/info.go#L247-L251
29,969
tsuna/gohbase
hrpc/procedure.go
NewGetProcedureState
func NewGetProcedureState(ctx context.Context, procID uint64) *GetProcedureState { return &GetProcedureState{ base: base{ ctx: ctx, resultch: make(chan RPCResult, 1), }, procID: procID, } }
go
func NewGetProcedureState(ctx context.Context, procID uint64) *GetProcedureState { return &GetProcedureState{ base: base{ ctx: ctx, resultch: make(chan RPCResult, 1), }, procID: procID, } }
[ "func", "NewGetProcedureState", "(", "ctx", "context", ".", "Context", ",", "procID", "uint64", ")", "*", "GetProcedureState", "{", "return", "&", "GetProcedureState", "{", "base", ":", "base", "{", "ctx", ":", "ctx", ",", "resultch", ":", "make", "(", "ch...
// NewGetProcedureState creates a new GetProcedureState request. For use by the admin client.
[ "NewGetProcedureState", "creates", "a", "new", "GetProcedureState", "request", ".", "For", "use", "by", "the", "admin", "client", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/procedure.go#L23-L31
29,970
tsuna/gohbase
client.go
ZookeeperTimeout
func ZookeeperTimeout(to time.Duration) Option { return func(c *client) { c.zkTimeout = to } }
go
func ZookeeperTimeout(to time.Duration) Option { return func(c *client) { c.zkTimeout = to } }
[ "func", "ZookeeperTimeout", "(", "to", "time", ".", "Duration", ")", "Option", "{", "return", "func", "(", "c", "*", "client", ")", "{", "c", ".", "zkTimeout", "=", "to", "\n", "}", "\n", "}" ]
// ZookeeperTimeout will return an option that will set the zookeeper session timeout.
[ "ZookeeperTimeout", "will", "return", "an", "option", "that", "will", "set", "the", "zookeeper", "session", "timeout", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/client.go#L165-L169
29,971
tsuna/gohbase
client.go
RegionLookupTimeout
func RegionLookupTimeout(to time.Duration) Option { return func(c *client) { c.regionLookupTimeout = to } }
go
func RegionLookupTimeout(to time.Duration) Option { return func(c *client) { c.regionLookupTimeout = to } }
[ "func", "RegionLookupTimeout", "(", "to", "time", ".", "Duration", ")", "Option", "{", "return", "func", "(", "c", "*", "client", ")", "{", "c", ".", "regionLookupTimeout", "=", "to", "\n", "}", "\n", "}" ]
// RegionLookupTimeout will return an option that sets the region lookup timeout
[ "RegionLookupTimeout", "will", "return", "an", "option", "that", "sets", "the", "region", "lookup", "timeout" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/client.go#L172-L176
29,972
tsuna/gohbase
client.go
RegionReadTimeout
func RegionReadTimeout(to time.Duration) Option { return func(c *client) { c.regionReadTimeout = to } }
go
func RegionReadTimeout(to time.Duration) Option { return func(c *client) { c.regionReadTimeout = to } }
[ "func", "RegionReadTimeout", "(", "to", "time", ".", "Duration", ")", "Option", "{", "return", "func", "(", "c", "*", "client", ")", "{", "c", ".", "regionReadTimeout", "=", "to", "\n", "}", "\n", "}" ]
// RegionReadTimeout will return an option that sets the region read timeout
[ "RegionReadTimeout", "will", "return", "an", "option", "that", "sets", "the", "region", "read", "timeout" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/client.go#L179-L183
29,973
tsuna/gohbase
client.go
FlushInterval
func FlushInterval(interval time.Duration) Option { return func(c *client) { c.flushInterval = interval } }
go
func FlushInterval(interval time.Duration) Option { return func(c *client) { c.flushInterval = interval } }
[ "func", "FlushInterval", "(", "interval", "time", ".", "Duration", ")", "Option", "{", "return", "func", "(", "c", "*", "client", ")", "{", "c", ".", "flushInterval", "=", "interval", "\n", "}", "\n", "}" ]
// FlushInterval will return an option that will set the timeout for flushing // the RPC queues used in a given client
[ "FlushInterval", "will", "return", "an", "option", "that", "will", "set", "the", "timeout", "for", "flushing", "the", "RPC", "queues", "used", "in", "a", "given", "client" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/client.go#L194-L198
29,974
tsuna/gohbase
client.go
Close
func (c *client) Close() { c.closeOnce.Do(func() { close(c.done) if c.clientType == adminClient { if ac := c.adminRegionInfo.Client(); ac != nil { ac.Close() } } c.clients.closeAll() }) }
go
func (c *client) Close() { c.closeOnce.Do(func() { close(c.done) if c.clientType == adminClient { if ac := c.adminRegionInfo.Client(); ac != nil { ac.Close() } } c.clients.closeAll() }) }
[ "func", "(", "c", "*", "client", ")", "Close", "(", ")", "{", "c", ".", "closeOnce", ".", "Do", "(", "func", "(", ")", "{", "close", "(", "c", ".", "done", ")", "\n", "if", "c", ".", "clientType", "==", "adminClient", "{", "if", "ac", ":=", "...
// Close closes connections to hbase master and regionservers
[ "Close", "closes", "connections", "to", "hbase", "master", "and", "regionservers" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/client.go#L201-L211
29,975
tsuna/gohbase
hrpc/disable.go
NewDisableTable
func NewDisableTable(ctx context.Context, table []byte) *DisableTable { return &DisableTable{ base{ table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, } }
go
func NewDisableTable(ctx context.Context, table []byte) *DisableTable { return &DisableTable{ base{ table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, } }
[ "func", "NewDisableTable", "(", "ctx", "context", ".", "Context", ",", "table", "[", "]", "byte", ")", "*", "DisableTable", "{", "return", "&", "DisableTable", "{", "base", "{", "table", ":", "table", ",", "ctx", ":", "ctx", ",", "resultch", ":", "make...
// NewDisableTable creates a new DisableTable request that will disable the // given table in HBase. For use by the admin client.
[ "NewDisableTable", "creates", "a", "new", "DisableTable", "request", "that", "will", "disable", "the", "given", "table", "in", "HBase", ".", "For", "use", "by", "the", "admin", "client", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/disable.go#L22-L30
29,976
tsuna/gohbase
hrpc/create.go
NewCreateTable
func NewCreateTable(ctx context.Context, table []byte, families map[string]map[string]string, options ...func(*CreateTable)) *CreateTable { ct := &CreateTable{ base: base{ table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, families: make(map[string]map[string]string, len(families)),...
go
func NewCreateTable(ctx context.Context, table []byte, families map[string]map[string]string, options ...func(*CreateTable)) *CreateTable { ct := &CreateTable{ base: base{ table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, families: make(map[string]map[string]string, len(families)),...
[ "func", "NewCreateTable", "(", "ctx", "context", ".", "Context", ",", "table", "[", "]", "byte", ",", "families", "map", "[", "string", "]", "map", "[", "string", "]", "string", ",", "options", "...", "func", "(", "*", "CreateTable", ")", ")", "*", "...
// NewCreateTable creates a new CreateTable request that will create the given // table in HBase. 'families' is a map of column family name to its attributes. // For use by the admin client.
[ "NewCreateTable", "creates", "a", "new", "CreateTable", "request", "that", "will", "create", "the", "given", "table", "in", "HBase", ".", "families", "is", "a", "map", "of", "column", "family", "name", "to", "its", "attributes", ".", "For", "use", "by", "t...
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/create.go#L40-L65
29,977
tsuna/gohbase
hrpc/delete.go
NewDeleteTable
func NewDeleteTable(ctx context.Context, table []byte) *DeleteTable { return &DeleteTable{ base{ table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, } }
go
func NewDeleteTable(ctx context.Context, table []byte) *DeleteTable { return &DeleteTable{ base{ table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, } }
[ "func", "NewDeleteTable", "(", "ctx", "context", ".", "Context", ",", "table", "[", "]", "byte", ")", "*", "DeleteTable", "{", "return", "&", "DeleteTable", "{", "base", "{", "table", ":", "table", ",", "ctx", ":", "ctx", ",", "resultch", ":", "make", ...
// NewDeleteTable creates a new DeleteTable request that will delete the // given table in HBase. For use by the admin client.
[ "NewDeleteTable", "creates", "a", "new", "DeleteTable", "request", "that", "will", "delete", "the", "given", "table", "in", "HBase", ".", "For", "use", "by", "the", "admin", "client", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/delete.go#L22-L30
29,978
tsuna/gohbase
hrpc/call.go
cellFromCellBlock
func cellFromCellBlock(b []byte) (*pb.Cell, uint32, error) { if len(b) < 4 { return nil, 0, fmt.Errorf( "buffer is too small: expected %d, got %d", 4, len(b)) } kvLen := binary.BigEndian.Uint32(b[0:4]) if len(b) < int(kvLen)+4 { return nil, 0, fmt.Errorf( "buffer is too small: expected %d, got %d", int(k...
go
func cellFromCellBlock(b []byte) (*pb.Cell, uint32, error) { if len(b) < 4 { return nil, 0, fmt.Errorf( "buffer is too small: expected %d, got %d", 4, len(b)) } kvLen := binary.BigEndian.Uint32(b[0:4]) if len(b) < int(kvLen)+4 { return nil, 0, fmt.Errorf( "buffer is too small: expected %d, got %d", int(k...
[ "func", "cellFromCellBlock", "(", "b", "[", "]", "byte", ")", "(", "*", "pb", ".", "Cell", ",", "uint32", ",", "error", ")", "{", "if", "len", "(", "b", ")", "<", "4", "{", "return", "nil", ",", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\""...
// cellFromCellBlock deserializes a cell from a reader
[ "cellFromCellBlock", "deserializes", "a", "cell", "from", "a", "reader" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/call.go#L176-L228
29,979
tsuna/gohbase
hrpc/call.go
ToLocalResult
func ToLocalResult(pbr *pb.Result) *Result { if pbr == nil { return &Result{} } return &Result{ // Should all be O(1) operations. Cells: toLocalCells(pbr), Stale: extractBool(pbr.Stale), Partial: extractBool(pbr.Partial), Exists: pbr.Exists, } }
go
func ToLocalResult(pbr *pb.Result) *Result { if pbr == nil { return &Result{} } return &Result{ // Should all be O(1) operations. Cells: toLocalCells(pbr), Stale: extractBool(pbr.Stale), Partial: extractBool(pbr.Partial), Exists: pbr.Exists, } }
[ "func", "ToLocalResult", "(", "pbr", "*", "pb", ".", "Result", ")", "*", "Result", "{", "if", "pbr", "==", "nil", "{", "return", "&", "Result", "{", "}", "\n", "}", "\n", "return", "&", "Result", "{", "// Should all be O(1) operations.", "Cells", ":", ...
// ToLocalResult takes a protobuf Result type and converts it to our own // Result type in constant time.
[ "ToLocalResult", "takes", "a", "protobuf", "Result", "type", "and", "converts", "it", "to", "our", "own", "Result", "type", "in", "constant", "time", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/call.go#L259-L270
29,980
tsuna/gohbase
caches.go
put
func (krc *keyRegionCache) put(reg hrpc.RegionInfo) (overlaps []hrpc.RegionInfo, replaced bool) { krc.m.Lock() krc.regions.Put(reg.Name(), func(v interface{}, exists bool) (interface{}, bool) { if exists { // region is already in cache, // note: regions with the same name have the same age overlaps = []hrp...
go
func (krc *keyRegionCache) put(reg hrpc.RegionInfo) (overlaps []hrpc.RegionInfo, replaced bool) { krc.m.Lock() krc.regions.Put(reg.Name(), func(v interface{}, exists bool) (interface{}, bool) { if exists { // region is already in cache, // note: regions with the same name have the same age overlaps = []hrp...
[ "func", "(", "krc", "*", "keyRegionCache", ")", "put", "(", "reg", "hrpc", ".", "RegionInfo", ")", "(", "overlaps", "[", "]", "hrpc", ".", "RegionInfo", ",", "replaced", "bool", ")", "{", "krc", ".", "m", ".", "Lock", "(", ")", "\n", "krc", ".", ...
// put looks up if there's already region with this name in regions cache // and if there's, returns it in overlaps and doesn't modify the cache. // Otherwise, it puts the region and removes all overlaps in case all of // them are older. Returns a slice of overlapping regions and whether // passed region was put in the...
[ "put", "looks", "up", "if", "there", "s", "already", "region", "with", "this", "name", "in", "regions", "cache", "and", "if", "there", "s", "returns", "it", "in", "overlaps", "and", "doesn", "t", "modify", "the", "cache", ".", "Otherwise", "it", "puts", ...
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/caches.go#L211-L262
29,981
tsuna/gohbase
scanner.go
coalesce
func (s *scanner) coalesce(result, partial *pb.Result) (*pb.Result, bool) { if result == nil { return partial, true } if !result.GetPartial() { // results is not partial, shouldn't coalesce return result, false } if len(partial.Cell) > 0 && !bytes.Equal(result.Cell[0].Row, partial.Cell[0].Row) { // new ro...
go
func (s *scanner) coalesce(result, partial *pb.Result) (*pb.Result, bool) { if result == nil { return partial, true } if !result.GetPartial() { // results is not partial, shouldn't coalesce return result, false } if len(partial.Cell) > 0 && !bytes.Equal(result.Cell[0].Row, partial.Cell[0].Row) { // new ro...
[ "func", "(", "s", "*", "scanner", ")", "coalesce", "(", "result", ",", "partial", "*", "pb", ".", "Result", ")", "(", "*", "pb", ".", "Result", ",", "bool", ")", "{", "if", "result", "==", "nil", "{", "return", "partial", ",", "true", "\n", "}", ...
// coalesce combines result with partial if they belong to the same row // and returns the coalesced result and whether coalescing happened
[ "coalesce", "combines", "result", "with", "partial", "if", "they", "belong", "to", "the", "same", "row", "and", "returns", "the", "coalesced", "result", "and", "whether", "coalescing", "happened" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/scanner.go#L118-L139
29,982
tsuna/gohbase
scanner.go
update
func (s *scanner) update(resp *pb.ScanResponse, region hrpc.RegionInfo) { if resp.GetMoreResultsInRegion() { if resp.ScannerId != nil { s.scannerID = resp.GetScannerId() } } else { // we are done with this region, prepare scan for next region s.scannerID = noScannerID // Normal Scan if !s.rpc.Reversed...
go
func (s *scanner) update(resp *pb.ScanResponse, region hrpc.RegionInfo) { if resp.GetMoreResultsInRegion() { if resp.ScannerId != nil { s.scannerID = resp.GetScannerId() } } else { // we are done with this region, prepare scan for next region s.scannerID = noScannerID // Normal Scan if !s.rpc.Reversed...
[ "func", "(", "s", "*", "scanner", ")", "update", "(", "resp", "*", "pb", ".", "ScanResponse", ",", "region", "hrpc", ".", "RegionInfo", ")", "{", "if", "resp", ".", "GetMoreResultsInRegion", "(", ")", "{", "if", "resp", ".", "ScannerId", "!=", "nil", ...
// update updates the scanner for the next scan request
[ "update", "updates", "the", "scanner", "for", "the", "next", "scan", "request" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/scanner.go#L243-L279
29,983
tsuna/gohbase
scanner.go
shouldClose
func (s *scanner) shouldClose(resp *pb.ScanResponse, region hrpc.RegionInfo) bool { if resp.MoreResults != nil && !*resp.MoreResults { // the filter for the whole scan has been exhausted, close the scanner return true } if s.scannerID != noScannerID { // not done with this region yet return false } // Ch...
go
func (s *scanner) shouldClose(resp *pb.ScanResponse, region hrpc.RegionInfo) bool { if resp.MoreResults != nil && !*resp.MoreResults { // the filter for the whole scan has been exhausted, close the scanner return true } if s.scannerID != noScannerID { // not done with this region yet return false } // Ch...
[ "func", "(", "s", "*", "scanner", ")", "shouldClose", "(", "resp", "*", "pb", ".", "ScanResponse", ",", "region", "hrpc", ".", "RegionInfo", ")", "bool", "{", "if", "resp", ".", "MoreResults", "!=", "nil", "&&", "!", "*", "resp", ".", "MoreResults", ...
// shouldClose check if this scanner should be closed and should stop fetching new results
[ "shouldClose", "check", "if", "this", "scanner", "should", "be", "closed", "and", "should", "stop", "fetching", "new", "results" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/scanner.go#L282-L311
29,984
tsuna/gohbase
rpc.go
clientDown
func (c *client) clientDown(client hrpc.RegionClient) { downregions := c.clients.clientDown(client) for downreg := range downregions { if downreg.MarkUnavailable() { downreg.SetClient(nil) go c.reestablishRegion(downreg) } } }
go
func (c *client) clientDown(client hrpc.RegionClient) { downregions := c.clients.clientDown(client) for downreg := range downregions { if downreg.MarkUnavailable() { downreg.SetClient(nil) go c.reestablishRegion(downreg) } } }
[ "func", "(", "c", "*", "client", ")", "clientDown", "(", "client", "hrpc", ".", "RegionClient", ")", "{", "downregions", ":=", "c", ".", "clients", ".", "clientDown", "(", "client", ")", "\n", "for", "downreg", ":=", "range", "downregions", "{", "if", ...
// clientDown removes client from cache and marks // all the regions sharing this region's // client as unavailable, and start a goroutine // to reconnect for each of them.
[ "clientDown", "removes", "client", "from", "cache", "and", "marks", "all", "the", "regions", "sharing", "this", "region", "s", "client", "as", "unavailable", "and", "start", "a", "goroutine", "to", "reconnect", "for", "each", "of", "them", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/rpc.go#L186-L194
29,985
tsuna/gohbase
rpc.go
getRegionFromCache
func (c *client) getRegionFromCache(table, key []byte) hrpc.RegionInfo { if c.clientType == adminClient { return c.adminRegionInfo } else if bytes.Equal(table, metaTableName) { return c.metaRegionInfo } regionName := createRegionSearchKey(table, key) _, region := c.regions.get(regionName) if region == nil { ...
go
func (c *client) getRegionFromCache(table, key []byte) hrpc.RegionInfo { if c.clientType == adminClient { return c.adminRegionInfo } else if bytes.Equal(table, metaTableName) { return c.metaRegionInfo } regionName := createRegionSearchKey(table, key) _, region := c.regions.get(regionName) if region == nil { ...
[ "func", "(", "c", "*", "client", ")", "getRegionFromCache", "(", "table", ",", "key", "[", "]", "byte", ")", "hrpc", ".", "RegionInfo", "{", "if", "c", ".", "clientType", "==", "adminClient", "{", "return", "c", ".", "adminRegionInfo", "\n", "}", "else...
// Searches in the regions cache for the region hosting the given row.
[ "Searches", "in", "the", "regions", "cache", "for", "the", "region", "hosting", "the", "given", "row", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/rpc.go#L301-L327
29,986
tsuna/gohbase
rpc.go
createRegionSearchKey
func createRegionSearchKey(table, key []byte) []byte { metaKey := make([]byte, 0, len(table)+len(key)+3) metaKey = append(metaKey, table...) metaKey = append(metaKey, ',') metaKey = append(metaKey, key...) metaKey = append(metaKey, ',') // ':' is the first byte greater than '9'. We always want to find the // en...
go
func createRegionSearchKey(table, key []byte) []byte { metaKey := make([]byte, 0, len(table)+len(key)+3) metaKey = append(metaKey, table...) metaKey = append(metaKey, ',') metaKey = append(metaKey, key...) metaKey = append(metaKey, ',') // ':' is the first byte greater than '9'. We always want to find the // en...
[ "func", "createRegionSearchKey", "(", "table", ",", "key", "[", "]", "byte", ")", "[", "]", "byte", "{", "metaKey", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "len", "(", "table", ")", "+", "len", "(", "key", ")", "+", "3", ")", "\n", ...
// Creates the META key to search for in order to locate the given key.
[ "Creates", "the", "META", "key", "to", "search", "for", "in", "order", "to", "locate", "the", "given", "key", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/rpc.go#L330-L341
29,987
tsuna/gohbase
rpc.go
metaLookup
func (c *client) metaLookup(ctx context.Context, table, key []byte) (hrpc.RegionInfo, string, error) { metaKey := createRegionSearchKey(table, key) rpc, err := hrpc.NewScanRange(ctx, metaTableName, metaKey, table, hrpc.Families(infoFamily), hrpc.Reversed(), hrpc.CloseScanner(), hrpc.NumberOfRows(1)) if err ...
go
func (c *client) metaLookup(ctx context.Context, table, key []byte) (hrpc.RegionInfo, string, error) { metaKey := createRegionSearchKey(table, key) rpc, err := hrpc.NewScanRange(ctx, metaTableName, metaKey, table, hrpc.Families(infoFamily), hrpc.Reversed(), hrpc.CloseScanner(), hrpc.NumberOfRows(1)) if err ...
[ "func", "(", "c", "*", "client", ")", "metaLookup", "(", "ctx", "context", ".", "Context", ",", "table", ",", "key", "[", "]", "byte", ")", "(", "hrpc", ".", "RegionInfo", ",", "string", ",", "error", ")", "{", "metaKey", ":=", "createRegionSearchKey",...
// metaLookup checks meta table for the region in which the given row key for the given table is.
[ "metaLookup", "checks", "meta", "table", "for", "the", "region", "in", "which", "the", "given", "row", "key", "for", "the", "given", "table", "is", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/rpc.go#L370-L406
29,988
tsuna/gohbase
rpc.go
probeKey
func probeKey(reg hrpc.RegionInfo) []byte { // now we create a probe key: reg.StartKey() + 17 zeros probe := make([]byte, len(reg.StartKey())+17) copy(probe, reg.StartKey()) return probe }
go
func probeKey(reg hrpc.RegionInfo) []byte { // now we create a probe key: reg.StartKey() + 17 zeros probe := make([]byte, len(reg.StartKey())+17) copy(probe, reg.StartKey()) return probe }
[ "func", "probeKey", "(", "reg", "hrpc", ".", "RegionInfo", ")", "[", "]", "byte", "{", "// now we create a probe key: reg.StartKey() + 17 zeros", "probe", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "reg", ".", "StartKey", "(", ")", ")", "+", "17...
// probeKey returns a key in region that is unlikely to have data at it // in order to test if the region is online. This prevents the Get request // to actually fetch the data from the storage which consumes resources // of the region server
[ "probeKey", "returns", "a", "key", "in", "region", "that", "is", "unlikely", "to", "have", "data", "at", "it", "in", "order", "to", "test", "if", "the", "region", "is", "online", ".", "This", "prevents", "the", "Get", "request", "to", "actually", "fetch"...
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/rpc.go#L437-L442
29,989
tsuna/gohbase
rpc.go
isRegionEstablished
func isRegionEstablished(rc hrpc.RegionClient, reg hrpc.RegionInfo) error { probe, err := hrpc.NewGet(context.Background(), fullyQualifiedTable(reg), probeKey(reg), hrpc.SkipBatch()) if err != nil { panic(fmt.Sprintf("should not happen: %s", err)) } probe.ExistsOnly() probe.SetRegion(reg) res, err := sendBlo...
go
func isRegionEstablished(rc hrpc.RegionClient, reg hrpc.RegionInfo) error { probe, err := hrpc.NewGet(context.Background(), fullyQualifiedTable(reg), probeKey(reg), hrpc.SkipBatch()) if err != nil { panic(fmt.Sprintf("should not happen: %s", err)) } probe.ExistsOnly() probe.SetRegion(reg) res, err := sendBlo...
[ "func", "isRegionEstablished", "(", "rc", "hrpc", ".", "RegionClient", ",", "reg", "hrpc", ".", "RegionInfo", ")", "error", "{", "probe", ",", "err", ":=", "hrpc", ".", "NewGet", "(", "context", ".", "Background", "(", ")", ",", "fullyQualifiedTable", "(",...
// isRegionEstablished checks whether regionserver accepts rpcs for the region. // Returns the cause if not established.
[ "isRegionEstablished", "checks", "whether", "regionserver", "accepts", "rpcs", "for", "the", "region", ".", "Returns", "the", "cause", "if", "not", "established", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/rpc.go#L446-L466
29,990
tsuna/gohbase
rpc.go
zkLookup
func (c *client) zkLookup(ctx context.Context, resource zk.ResourceName) (string, error) { // We make this a buffered channel so that if we stop waiting due to a // timeout, we won't block the zkLookupSync() that we start in a // separate goroutine. reschan := make(chan zkResult, 1) go func() { addr, err := c.zk...
go
func (c *client) zkLookup(ctx context.Context, resource zk.ResourceName) (string, error) { // We make this a buffered channel so that if we stop waiting due to a // timeout, we won't block the zkLookupSync() that we start in a // separate goroutine. reschan := make(chan zkResult, 1) go func() { addr, err := c.zk...
[ "func", "(", "c", "*", "client", ")", "zkLookup", "(", "ctx", "context", ".", "Context", ",", "resource", "zk", ".", "ResourceName", ")", "(", "string", ",", "error", ")", "{", "// We make this a buffered channel so that if we stop waiting due to a", "// timeout, we...
// zkLookup asynchronously looks up the meta region or HMaster in ZooKeeper.
[ "zkLookup", "asynchronously", "looks", "up", "the", "meta", "region", "or", "HMaster", "in", "ZooKeeper", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/rpc.go#L638-L654
29,991
tsuna/gohbase
hrpc/get.go
baseGet
func baseGet(ctx context.Context, table []byte, key []byte, options ...func(Call) error) (*Get, error) { g := &Get{ base: base{ key: key, table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, baseQuery: newBaseQuery(), } err := applyOptions(g, options...) if err != nil { re...
go
func baseGet(ctx context.Context, table []byte, key []byte, options ...func(Call) error) (*Get, error) { g := &Get{ base: base{ key: key, table: table, ctx: ctx, resultch: make(chan RPCResult, 1), }, baseQuery: newBaseQuery(), } err := applyOptions(g, options...) if err != nil { re...
[ "func", "baseGet", "(", "ctx", "context", ".", "Context", ",", "table", "[", "]", "byte", ",", "key", "[", "]", "byte", ",", "options", "...", "func", "(", "Call", ")", "error", ")", "(", "*", "Get", ",", "error", ")", "{", "g", ":=", "&", "Get...
// baseGet returns a Get struct with default values set.
[ "baseGet", "returns", "a", "Get", "struct", "with", "default", "values", "set", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/get.go#L26-L42
29,992
tsuna/gohbase
hrpc/get.go
NewGet
func NewGet(ctx context.Context, table, key []byte, options ...func(Call) error) (*Get, error) { return baseGet(ctx, table, key, options...) }
go
func NewGet(ctx context.Context, table, key []byte, options ...func(Call) error) (*Get, error) { return baseGet(ctx, table, key, options...) }
[ "func", "NewGet", "(", "ctx", "context", ".", "Context", ",", "table", ",", "key", "[", "]", "byte", ",", "options", "...", "func", "(", "Call", ")", "error", ")", "(", "*", "Get", ",", "error", ")", "{", "return", "baseGet", "(", "ctx", ",", "ta...
// NewGet creates a new Get request for the given table and row key.
[ "NewGet", "creates", "a", "new", "Get", "request", "for", "the", "given", "table", "and", "row", "key", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/get.go#L45-L48
29,993
tsuna/gohbase
hrpc/get.go
NewGetStr
func NewGetStr(ctx context.Context, table, key string, options ...func(Call) error) (*Get, error) { return NewGet(ctx, []byte(table), []byte(key), options...) }
go
func NewGetStr(ctx context.Context, table, key string, options ...func(Call) error) (*Get, error) { return NewGet(ctx, []byte(table), []byte(key), options...) }
[ "func", "NewGetStr", "(", "ctx", "context", ".", "Context", ",", "table", ",", "key", "string", ",", "options", "...", "func", "(", "Call", ")", "error", ")", "(", "*", "Get", ",", "error", ")", "{", "return", "NewGet", "(", "ctx", ",", "[", "]", ...
// NewGetStr creates a new Get request for the given table and row key.
[ "NewGetStr", "creates", "a", "new", "Get", "request", "for", "the", "given", "table", "and", "row", "key", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/get.go#L51-L54
29,994
tsuna/gohbase
hrpc/get.go
ToProto
func (g *Get) ToProto() proto.Message { get := &pb.GetRequest{ Region: g.regionSpecifier(), Get: &pb.Get{ Row: g.key, Column: familiesToColumn(g.families), TimeRange: &pb.TimeRange{}, }, } /* added support for limit number of cells per row */ if g.storeLimit != DefaultMaxResultsPerColumnFam...
go
func (g *Get) ToProto() proto.Message { get := &pb.GetRequest{ Region: g.regionSpecifier(), Get: &pb.Get{ Row: g.key, Column: familiesToColumn(g.families), TimeRange: &pb.TimeRange{}, }, } /* added support for limit number of cells per row */ if g.storeLimit != DefaultMaxResultsPerColumnFam...
[ "func", "(", "g", "*", "Get", ")", "ToProto", "(", ")", "proto", ".", "Message", "{", "get", ":=", "&", "pb", ".", "GetRequest", "{", "Region", ":", "g", ".", "regionSpecifier", "(", ")", ",", "Get", ":", "&", "pb", ".", "Get", "{", "Row", ":",...
// ToProto converts this RPC into a protobuf message.
[ "ToProto", "converts", "this", "RPC", "into", "a", "protobuf", "message", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/get.go#L78-L110
29,995
tsuna/gohbase
hrpc/get.go
DeserializeCellBlocks
func (g *Get) DeserializeCellBlocks(m proto.Message, b []byte) (uint32, error) { resp := m.(*pb.GetResponse) if resp.Result == nil { // TODO: is this possible? return 0, nil } cells, read, err := deserializeCellBlocks(b, uint32(resp.Result.GetAssociatedCellCount())) if err != nil { return 0, err } resp.Res...
go
func (g *Get) DeserializeCellBlocks(m proto.Message, b []byte) (uint32, error) { resp := m.(*pb.GetResponse) if resp.Result == nil { // TODO: is this possible? return 0, nil } cells, read, err := deserializeCellBlocks(b, uint32(resp.Result.GetAssociatedCellCount())) if err != nil { return 0, err } resp.Res...
[ "func", "(", "g", "*", "Get", ")", "DeserializeCellBlocks", "(", "m", "proto", ".", "Message", ",", "b", "[", "]", "byte", ")", "(", "uint32", ",", "error", ")", "{", "resp", ":=", "m", ".", "(", "*", "pb", ".", "GetResponse", ")", "\n", "if", ...
// DeserializeCellBlocks deserializes get result from cell blocks
[ "DeserializeCellBlocks", "deserializes", "get", "result", "from", "cell", "blocks" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/get.go#L119-L131
29,996
tsuna/gohbase
hrpc/get.go
familiesToColumn
func familiesToColumn(families map[string][]string) []*pb.Column { cols := make([]*pb.Column, len(families)) counter := 0 for family, qualifiers := range families { bytequals := make([][]byte, len(qualifiers)) for i, qual := range qualifiers { bytequals[i] = []byte(qual) } cols[counter] = &pb.Column{ F...
go
func familiesToColumn(families map[string][]string) []*pb.Column { cols := make([]*pb.Column, len(families)) counter := 0 for family, qualifiers := range families { bytequals := make([][]byte, len(qualifiers)) for i, qual := range qualifiers { bytequals[i] = []byte(qual) } cols[counter] = &pb.Column{ F...
[ "func", "familiesToColumn", "(", "families", "map", "[", "string", "]", "[", "]", "string", ")", "[", "]", "*", "pb", ".", "Column", "{", "cols", ":=", "make", "(", "[", "]", "*", "pb", ".", "Column", ",", "len", "(", "families", ")", ")", "\n", ...
// familiesToColumn takes a map from strings to lists of strings, and converts // them into protobuf Columns
[ "familiesToColumn", "takes", "a", "map", "from", "strings", "to", "lists", "of", "strings", "and", "converts", "them", "into", "protobuf", "Columns" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/hrpc/get.go#L135-L150
29,997
tsuna/gohbase
zk/client.go
Prepend
func (r ResourceName) Prepend(prefix string) ResourceName { return ResourceName(path.Join(prefix, string(r))) }
go
func (r ResourceName) Prepend(prefix string) ResourceName { return ResourceName(path.Join(prefix, string(r))) }
[ "func", "(", "r", "ResourceName", ")", "Prepend", "(", "prefix", "string", ")", "ResourceName", "{", "return", "ResourceName", "(", "path", ".", "Join", "(", "prefix", ",", "string", "(", "r", ")", ")", ")", "\n", "}" ]
// Prepend creates a new ResourceName with prefix prepended to the former ResourceName.
[ "Prepend", "creates", "a", "new", "ResourceName", "with", "prefix", "prepended", "to", "the", "former", "ResourceName", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/zk/client.go#L39-L41
29,998
tsuna/gohbase
zk/client.go
NewClient
func NewClient(zkquorum string, st time.Duration) Client { return &client{ zks: strings.Split(zkquorum, ","), sessionTimeout: st, } }
go
func NewClient(zkquorum string, st time.Duration) Client { return &client{ zks: strings.Split(zkquorum, ","), sessionTimeout: st, } }
[ "func", "NewClient", "(", "zkquorum", "string", ",", "st", "time", ".", "Duration", ")", "Client", "{", "return", "&", "client", "{", "zks", ":", "strings", ".", "Split", "(", "zkquorum", ",", "\"", "\"", ")", ",", "sessionTimeout", ":", "st", ",", "...
// NewClient establishes connection to zookeeper and returns the client
[ "NewClient", "establishes", "connection", "to", "zookeeper", "and", "returns", "the", "client" ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/zk/client.go#L64-L69
29,999
tsuna/gohbase
zk/client.go
LocateResource
func (c *client) LocateResource(resource ResourceName) (string, error) { conn, _, err := zk.Connect(c.zks, c.sessionTimeout) if err != nil { return "", fmt.Errorf("error connecting to ZooKeeper at %v: %s", c.zks, err) } defer conn.Close() buf, _, err := conn.Get(string(resource)) if err != nil { return "", f...
go
func (c *client) LocateResource(resource ResourceName) (string, error) { conn, _, err := zk.Connect(c.zks, c.sessionTimeout) if err != nil { return "", fmt.Errorf("error connecting to ZooKeeper at %v: %s", c.zks, err) } defer conn.Close() buf, _, err := conn.Get(string(resource)) if err != nil { return "", f...
[ "func", "(", "c", "*", "client", ")", "LocateResource", "(", "resource", "ResourceName", ")", "(", "string", ",", "error", ")", "{", "conn", ",", "_", ",", "err", ":=", "zk", ".", "Connect", "(", "c", ".", "zks", ",", "c", ".", "sessionTimeout", ")...
// LocateResource returns address of the server for the specified resource.
[ "LocateResource", "returns", "address", "of", "the", "server", "for", "the", "specified", "resource", "." ]
24ffed0537aae38093b39c12781e4c09f8cb0029
https://github.com/tsuna/gohbase/blob/24ffed0537aae38093b39c12781e4c09f8cb0029/zk/client.go#L72-L118