id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
134,700
FDio/govpp
core/connection.go
connectLoop
func (c *Connection) connectLoop(connChan chan ConnectionEvent) { reconnectAttempts := 0 // loop until connected for { if err := c.vppClient.WaitReady(); err != nil { log.Warnf("wait ready failed: %v", err) } if err := c.connectVPP(); err == nil { // signal connected event connChan <- ConnectionEvent...
go
func (c *Connection) connectLoop(connChan chan ConnectionEvent) { reconnectAttempts := 0 // loop until connected for { if err := c.vppClient.WaitReady(); err != nil { log.Warnf("wait ready failed: %v", err) } if err := c.connectVPP(); err == nil { // signal connected event connChan <- ConnectionEvent...
[ "func", "(", "c", "*", "Connection", ")", "connectLoop", "(", "connChan", "chan", "ConnectionEvent", ")", "{", "reconnectAttempts", ":=", "0", "\n\n", "// loop until connected", "for", "{", "if", "err", ":=", "c", ".", "vppClient", ".", "WaitReady", "(", ")"...
// connectLoop attempts to connect to VPP until it succeeds. // Then it continues with healthCheckLoop.
[ "connectLoop", "attempts", "to", "connect", "to", "VPP", "until", "it", "succeeds", ".", "Then", "it", "continues", "with", "healthCheckLoop", "." ]
f614a0af720702c8db959b6641b4faea5f98c339
https://github.com/FDio/govpp/blob/f614a0af720702c8db959b6641b4faea5f98c339/core/connection.go#L253-L277
134,701
FDio/govpp
core/connection.go
healthCheckLoop
func (c *Connection) healthCheckLoop(connChan chan ConnectionEvent) { // create a separate API channel for health check probes ch, err := c.newAPIChannel(1, 1) if err != nil { log.Error("Failed to create health check API channel, health check will be disabled:", err) return } var ( sinceLastReply time.Durat...
go
func (c *Connection) healthCheckLoop(connChan chan ConnectionEvent) { // create a separate API channel for health check probes ch, err := c.newAPIChannel(1, 1) if err != nil { log.Error("Failed to create health check API channel, health check will be disabled:", err) return } var ( sinceLastReply time.Durat...
[ "func", "(", "c", "*", "Connection", ")", "healthCheckLoop", "(", "connChan", "chan", "ConnectionEvent", ")", "{", "// create a separate API channel for health check probes", "ch", ",", "err", ":=", "c", ".", "newAPIChannel", "(", "1", ",", "1", ")", "\n", "if",...
// healthCheckLoop checks whether connection to VPP is alive. In case of disconnect, // it continues with connectLoop and tries to reconnect.
[ "healthCheckLoop", "checks", "whether", "connection", "to", "VPP", "is", "alive", ".", "In", "case", "of", "disconnect", "it", "continues", "with", "connectLoop", "and", "tries", "to", "reconnect", "." ]
f614a0af720702c8db959b6641b4faea5f98c339
https://github.com/FDio/govpp/blob/f614a0af720702c8db959b6641b4faea5f98c339/core/connection.go#L281-L365
134,702
FDio/govpp
core/connection.go
GetMessageID
func (c *Connection) GetMessageID(msg api.Message) (uint16, error) { if c == nil { return 0, errors.New("nil connection passed in") } if msgID, ok := c.msgIDs[getMsgNameWithCrc(msg)]; ok { return msgID, nil } msgID, err := c.vppClient.GetMsgID(msg.GetMessageName(), msg.GetCrcString()) if err != nil { retu...
go
func (c *Connection) GetMessageID(msg api.Message) (uint16, error) { if c == nil { return 0, errors.New("nil connection passed in") } if msgID, ok := c.msgIDs[getMsgNameWithCrc(msg)]; ok { return msgID, nil } msgID, err := c.vppClient.GetMsgID(msg.GetMessageName(), msg.GetCrcString()) if err != nil { retu...
[ "func", "(", "c", "*", "Connection", ")", "GetMessageID", "(", "msg", "api", ".", "Message", ")", "(", "uint16", ",", "error", ")", "{", "if", "c", "==", "nil", "{", "return", "0", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n...
// GetMessageID returns message identifier of given API message.
[ "GetMessageID", "returns", "message", "identifier", "of", "given", "API", "message", "." ]
f614a0af720702c8db959b6641b4faea5f98c339
https://github.com/FDio/govpp/blob/f614a0af720702c8db959b6641b4faea5f98c339/core/connection.go#L378-L396
134,703
FDio/govpp
core/connection.go
LookupByID
func (c *Connection) LookupByID(msgID uint16) (api.Message, error) { if c == nil { return nil, errors.New("nil connection passed in") } if msg, ok := c.msgMap[msgID]; ok { return msg, nil } return nil, fmt.Errorf("unknown message ID: %d", msgID) }
go
func (c *Connection) LookupByID(msgID uint16) (api.Message, error) { if c == nil { return nil, errors.New("nil connection passed in") } if msg, ok := c.msgMap[msgID]; ok { return msg, nil } return nil, fmt.Errorf("unknown message ID: %d", msgID) }
[ "func", "(", "c", "*", "Connection", ")", "LookupByID", "(", "msgID", "uint16", ")", "(", "api", ".", "Message", ",", "error", ")", "{", "if", "c", "==", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "...
// LookupByID looks up message name and crc by ID.
[ "LookupByID", "looks", "up", "message", "name", "and", "crc", "by", "ID", "." ]
f614a0af720702c8db959b6641b4faea5f98c339
https://github.com/FDio/govpp/blob/f614a0af720702c8db959b6641b4faea5f98c339/core/connection.go#L399-L409
134,704
FDio/govpp
core/connection.go
retrieveMessageIDs
func (c *Connection) retrieveMessageIDs() (err error) { t := time.Now() msgs := api.GetRegisteredMessages() var n int for name, msg := range msgs { msgID, err := c.GetMessageID(msg) if err != nil { log.Debugf("retrieving msgID for %s failed: %v", name, err) continue } n++ if c.pingReqID == 0 && m...
go
func (c *Connection) retrieveMessageIDs() (err error) { t := time.Now() msgs := api.GetRegisteredMessages() var n int for name, msg := range msgs { msgID, err := c.GetMessageID(msg) if err != nil { log.Debugf("retrieving msgID for %s failed: %v", name, err) continue } n++ if c.pingReqID == 0 && m...
[ "func", "(", "c", "*", "Connection", ")", "retrieveMessageIDs", "(", ")", "(", "err", "error", ")", "{", "t", ":=", "time", ".", "Now", "(", ")", "\n\n", "msgs", ":=", "api", ".", "GetRegisteredMessages", "(", ")", "\n\n", "var", "n", "int", "\n", ...
// retrieveMessageIDs retrieves IDs for all registered messages and stores them in map
[ "retrieveMessageIDs", "retrieves", "IDs", "for", "all", "registered", "messages", "and", "stores", "them", "in", "map" ]
f614a0af720702c8db959b6641b4faea5f98c339
https://github.com/FDio/govpp/blob/f614a0af720702c8db959b6641b4faea5f98c339/core/connection.go#L412-L441
134,705
mailgun/lemma
httpsign/nonce.go
NewNonceCache
func NewNonceCache(capacity int, cacheTTL int, timeProvider timetools.TimeProvider) (*NonceCache, error) { c, err := ttlmap.NewMapWithProvider(capacity, timeProvider) if err != nil { return nil, err } return &NonceCache{ cache: c, cacheTTL: cacheTTL, timeProvider: timeProvider, }, nil }
go
func NewNonceCache(capacity int, cacheTTL int, timeProvider timetools.TimeProvider) (*NonceCache, error) { c, err := ttlmap.NewMapWithProvider(capacity, timeProvider) if err != nil { return nil, err } return &NonceCache{ cache: c, cacheTTL: cacheTTL, timeProvider: timeProvider, }, nil }
[ "func", "NewNonceCache", "(", "capacity", "int", ",", "cacheTTL", "int", ",", "timeProvider", "timetools", ".", "TimeProvider", ")", "(", "*", "NonceCache", ",", "error", ")", "{", "c", ",", "err", ":=", "ttlmap", ".", "NewMapWithProvider", "(", "capacity", ...
// Return a new NonceCache. Allows you to control cache capacity, ttl, as well as the TimeProvider.
[ "Return", "a", "new", "NonceCache", ".", "Allows", "you", "to", "control", "cache", "capacity", "ttl", "as", "well", "as", "the", "TimeProvider", "." ]
4214099fb348c416514bc2c93087fde56216d7b5
https://github.com/mailgun/lemma/blob/4214099fb348c416514bc2c93087fde56216d7b5/httpsign/nonce.go#L18-L29
134,706
mailgun/lemma
httpsign/auth.go
NewWithProviders
func NewWithProviders(config *Config, timeProvider timetools.TimeProvider, randomProvider random.RandomProvider) (*Service, error) { // config is required! if config == nil { return nil, fmt.Errorf("config is required.") } // set defaults if not set if config.NonceCacheCapacity < 1 { config.NonceCacheCapaci...
go
func NewWithProviders(config *Config, timeProvider timetools.TimeProvider, randomProvider random.RandomProvider) (*Service, error) { // config is required! if config == nil { return nil, fmt.Errorf("config is required.") } // set defaults if not set if config.NonceCacheCapacity < 1 { config.NonceCacheCapaci...
[ "func", "NewWithProviders", "(", "config", "*", "Config", ",", "timeProvider", "timetools", ".", "TimeProvider", ",", "randomProvider", "random", ".", "RandomProvider", ")", "(", "*", "Service", ",", "error", ")", "{", "// config is required!", "if", "config", "...
// Returns a new Service. Provides control over time and random providers.
[ "Returns", "a", "new", "Service", ".", "Provides", "control", "over", "time", "and", "random", "providers", "." ]
4214099fb348c416514bc2c93087fde56216d7b5
https://github.com/mailgun/lemma/blob/4214099fb348c416514bc2c93087fde56216d7b5/httpsign/auth.go#L77-L157
134,707
mailgun/lemma
httpsign/auth.go
SignRequestWithKey
func (s *Service) SignRequestWithKey(r *http.Request, secretKey []byte) error { // extract request body bytes bodyBytes, err := readBody(r) if err != nil { return err } // extract any headers if requested headerValues, err := extractHeaderValues(r, s.config.HeadersToSign) if err != nil { return err } // ...
go
func (s *Service) SignRequestWithKey(r *http.Request, secretKey []byte) error { // extract request body bytes bodyBytes, err := readBody(r) if err != nil { return err } // extract any headers if requested headerValues, err := extractHeaderValues(r, s.config.HeadersToSign) if err != nil { return err } // ...
[ "func", "(", "s", "*", "Service", ")", "SignRequestWithKey", "(", "r", "*", "http", ".", "Request", ",", "secretKey", "[", "]", "byte", ")", "error", "{", "// extract request body bytes", "bodyBytes", ",", "err", ":=", "readBody", "(", "r", ")", "\n", "i...
// Signs a given HTTP request with signature, nonce, and timestamp. Signs the // message with the passed in key not the one initialized with.
[ "Signs", "a", "given", "HTTP", "request", "with", "signature", "nonce", "and", "timestamp", ".", "Signs", "the", "message", "with", "the", "passed", "in", "key", "not", "the", "one", "initialized", "with", "." ]
4214099fb348c416514bc2c93087fde56216d7b5
https://github.com/mailgun/lemma/blob/4214099fb348c416514bc2c93087fde56216d7b5/httpsign/auth.go#L169-L206
134,708
mailgun/lemma
secret/key.go
NewKey
func NewKey() (*[SecretKeyLength]byte, error) { // get 32-bytes of random from /dev/urandom bytes, err := randomProvider.Bytes(SecretKeyLength) if err != nil { return nil, fmt.Errorf("unable to generate random: %v", err) } return KeySliceToArray(bytes) }
go
func NewKey() (*[SecretKeyLength]byte, error) { // get 32-bytes of random from /dev/urandom bytes, err := randomProvider.Bytes(SecretKeyLength) if err != nil { return nil, fmt.Errorf("unable to generate random: %v", err) } return KeySliceToArray(bytes) }
[ "func", "NewKey", "(", ")", "(", "*", "[", "SecretKeyLength", "]", "byte", ",", "error", ")", "{", "// get 32-bytes of random from /dev/urandom", "bytes", ",", "err", ":=", "randomProvider", ".", "Bytes", "(", "SecretKeyLength", ")", "\n", "if", "err", "!=", ...
// NewKey returns a new key that can be used to encrypt and decrypt messages.
[ "NewKey", "returns", "a", "new", "key", "that", "can", "be", "used", "to", "encrypt", "and", "decrypt", "messages", "." ]
4214099fb348c416514bc2c93087fde56216d7b5
https://github.com/mailgun/lemma/blob/4214099fb348c416514bc2c93087fde56216d7b5/secret/key.go#L10-L18
134,709
xiam/exif
exif.go
Read
func Read(file string) (*Data, error) { data := New() if err := data.Open(file); err != nil { return nil, err } return data, nil }
go
func Read(file string) (*Data, error) { data := New() if err := data.Open(file); err != nil { return nil, err } return data, nil }
[ "func", "Read", "(", "file", "string", ")", "(", "*", "Data", ",", "error", ")", "{", "data", ":=", "New", "(", ")", "\n", "if", "err", ":=", "data", ".", "Open", "(", "file", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\...
// Read attempts to read EXIF data from a file.
[ "Read", "attempts", "to", "read", "EXIF", "data", "from", "a", "file", "." ]
33e82e3db72f03c4d55d10b7275d267fc7cd0e45
https://github.com/xiam/exif/blob/33e82e3db72f03c4d55d10b7275d267fc7cd0e45/exif.go#L66-L72
134,710
xiam/exif
exif.go
Open
func (d *Data) Open(file string) error { cfile := C.CString(file) defer C.free(unsafe.Pointer(cfile)) exifData := C.exif_data_new_from_file(cfile) if exifData == nil { return ErrNoExifData } defer C.exif_data_unref(exifData) return d.parseExifData(exifData) }
go
func (d *Data) Open(file string) error { cfile := C.CString(file) defer C.free(unsafe.Pointer(cfile)) exifData := C.exif_data_new_from_file(cfile) if exifData == nil { return ErrNoExifData } defer C.exif_data_unref(exifData) return d.parseExifData(exifData) }
[ "func", "(", "d", "*", "Data", ")", "Open", "(", "file", "string", ")", "error", "{", "cfile", ":=", "C", ".", "CString", "(", "file", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cfile", ")", ")", "\n\n", "exifData"...
// Open opens a file path and loads its EXIF data.
[ "Open", "opens", "a", "file", "path", "and", "loads", "its", "EXIF", "data", "." ]
33e82e3db72f03c4d55d10b7275d267fc7cd0e45
https://github.com/xiam/exif/blob/33e82e3db72f03c4d55d10b7275d267fc7cd0e45/exif.go#L75-L88
134,711
xiam/exif
exif.go
Write
func (d *Data) Write(p []byte) (n int, err error) { if d.exifLoader == nil { d.exifLoader = C.exif_loader_new() runtime.SetFinalizer(d, (*Data).cleanup) } res := C.exif_loader_write(d.exifLoader, (*C.uchar)(unsafe.Pointer(&p[0])), C.uint(len(p))) if res == 1 { return len(p), nil } return len(p), ErrFoundE...
go
func (d *Data) Write(p []byte) (n int, err error) { if d.exifLoader == nil { d.exifLoader = C.exif_loader_new() runtime.SetFinalizer(d, (*Data).cleanup) } res := C.exif_loader_write(d.exifLoader, (*C.uchar)(unsafe.Pointer(&p[0])), C.uint(len(p))) if res == 1 { return len(p), nil } return len(p), ErrFoundE...
[ "func", "(", "d", "*", "Data", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "d", ".", "exifLoader", "==", "nil", "{", "d", ".", "exifLoader", "=", "C", ".", "exif_loader_new", "(", ")", ...
// Write writes bytes to the exif loader. Sends ErrFoundExifInData error when // enough bytes have been sent.
[ "Write", "writes", "bytes", "to", "the", "exif", "loader", ".", "Sends", "ErrFoundExifInData", "error", "when", "enough", "bytes", "have", "been", "sent", "." ]
33e82e3db72f03c4d55d10b7275d267fc7cd0e45
https://github.com/xiam/exif/blob/33e82e3db72f03c4d55d10b7275d267fc7cd0e45/exif.go#L109-L121
134,712
xiam/exif
exif.go
Parse
func (d *Data) Parse() error { defer d.cleanup() exifData := C.exif_loader_get_data(d.exifLoader) if exifData == nil { return fmt.Errorf(ErrNoExifData.Error(), "") } defer func() { C.exif_data_unref(exifData) }() return d.parseExifData(exifData) }
go
func (d *Data) Parse() error { defer d.cleanup() exifData := C.exif_loader_get_data(d.exifLoader) if exifData == nil { return fmt.Errorf(ErrNoExifData.Error(), "") } defer func() { C.exif_data_unref(exifData) }() return d.parseExifData(exifData) }
[ "func", "(", "d", "*", "Data", ")", "Parse", "(", ")", "error", "{", "defer", "d", ".", "cleanup", "(", ")", "\n\n", "exifData", ":=", "C", ".", "exif_loader_get_data", "(", "d", ".", "exifLoader", ")", "\n", "if", "exifData", "==", "nil", "{", "re...
// Parse finalizes the data loader and sets the tags
[ "Parse", "finalizes", "the", "data", "loader", "and", "sets", "the", "tags" ]
33e82e3db72f03c4d55d10b7275d267fc7cd0e45
https://github.com/xiam/exif/blob/33e82e3db72f03c4d55d10b7275d267fc7cd0e45/exif.go#L124-L137
134,713
tomcraven/goga
bitset.go
Create
func (b *Bitset) Create(size int) { b.size = size b.bits = make([]int, size) }
go
func (b *Bitset) Create(size int) { b.size = size b.bits = make([]int, size) }
[ "func", "(", "b", "*", "Bitset", ")", "Create", "(", "size", "int", ")", "{", "b", ".", "size", "=", "size", "\n", "b", ".", "bits", "=", "make", "(", "[", "]", "int", ",", "size", ")", "\n", "}" ]
// Create - creates a bitset of length 'size'
[ "Create", "-", "creates", "a", "bitset", "of", "length", "size" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/bitset.go#L10-L13
134,714
tomcraven/goga
bitset.go
Get
func (b *Bitset) Get(index int) int { if index < b.size { return b.bits[index] } return -1 }
go
func (b *Bitset) Get(index int) int { if index < b.size { return b.bits[index] } return -1 }
[ "func", "(", "b", "*", "Bitset", ")", "Get", "(", "index", "int", ")", "int", "{", "if", "index", "<", "b", ".", "size", "{", "return", "b", ".", "bits", "[", "index", "]", "\n", "}", "\n", "return", "-", "1", "\n", "}" ]
// Get returns the value in the bitset at index 'index' // or -1 if the index is out of range
[ "Get", "returns", "the", "value", "in", "the", "bitset", "at", "index", "index", "or", "-", "1", "if", "the", "index", "is", "out", "of", "range" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/bitset.go#L22-L27
134,715
tomcraven/goga
bitset.go
Set
func (b *Bitset) Set(index, value int) bool { if index < b.size { b.setImpl(index, value) return true } return false }
go
func (b *Bitset) Set(index, value int) bool { if index < b.size { b.setImpl(index, value) return true } return false }
[ "func", "(", "b", "*", "Bitset", ")", "Set", "(", "index", ",", "value", "int", ")", "bool", "{", "if", "index", "<", "b", ".", "size", "{", "b", ".", "setImpl", "(", "index", ",", "value", ")", "\n", "return", "true", "\n", "}", "\n", "return"...
// Set assigns value 'value' to the bit at index 'index'
[ "Set", "assigns", "value", "value", "to", "the", "bit", "at", "index", "index" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/bitset.go#L39-L45
134,716
tomcraven/goga
bitset.go
SetAll
func (b *Bitset) SetAll(value int) { for i := 0; i < b.size; i++ { b.setImpl(i, value) } }
go
func (b *Bitset) SetAll(value int) { for i := 0; i < b.size; i++ { b.setImpl(i, value) } }
[ "func", "(", "b", "*", "Bitset", ")", "SetAll", "(", "value", "int", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "b", ".", "size", ";", "i", "++", "{", "b", ".", "setImpl", "(", "i", ",", "value", ")", "\n", "}", "\n", "}" ]
// SetAll assigns the value 'value' to all the bits in the set
[ "SetAll", "assigns", "the", "value", "value", "to", "all", "the", "bits", "in", "the", "set" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/bitset.go#L48-L52
134,717
tomcraven/goga
bitset.go
CreateCopy
func (b *Bitset) CreateCopy() Bitset { newBitset := Bitset{} newBitset.Create(b.size) for i := 0; i < b.size; i++ { newBitset.Set(i, b.Get(i)) } return newBitset }
go
func (b *Bitset) CreateCopy() Bitset { newBitset := Bitset{} newBitset.Create(b.size) for i := 0; i < b.size; i++ { newBitset.Set(i, b.Get(i)) } return newBitset }
[ "func", "(", "b", "*", "Bitset", ")", "CreateCopy", "(", ")", "Bitset", "{", "newBitset", ":=", "Bitset", "{", "}", "\n", "newBitset", ".", "Create", "(", "b", ".", "size", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "b", ".", "size", ";",...
// CreateCopy returns a bit for bit copy of the bitset
[ "CreateCopy", "returns", "a", "bit", "for", "bit", "copy", "of", "the", "bitset" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/bitset.go#L55-L62
134,718
tomcraven/goga
bitset.go
Slice
func (b *Bitset) Slice(startingBit, size int) Bitset { ret := Bitset{} ret.Create(size) ret.bits = b.bits[startingBit : startingBit+size] return ret }
go
func (b *Bitset) Slice(startingBit, size int) Bitset { ret := Bitset{} ret.Create(size) ret.bits = b.bits[startingBit : startingBit+size] return ret }
[ "func", "(", "b", "*", "Bitset", ")", "Slice", "(", "startingBit", ",", "size", "int", ")", "Bitset", "{", "ret", ":=", "Bitset", "{", "}", "\n", "ret", ".", "Create", "(", "size", ")", "\n", "ret", ".", "bits", "=", "b", ".", "bits", "[", "sta...
// Slice returns an out of memory slice of the current bitset // between bits 'startingBit' and 'startingBit + size'
[ "Slice", "returns", "an", "out", "of", "memory", "slice", "of", "the", "current", "bitset", "between", "bits", "startingBit", "and", "startingBit", "+", "size" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/bitset.go#L66-L71
134,719
tomcraven/goga
genetic_algorithm.go
NewGeneticAlgorithm
func NewGeneticAlgorithm() GeneticAlgorithm { return GeneticAlgorithm{ EliteConsumer: &NullEliteConsumer{}, Mater: &NullMater{}, Simulator: &NullSimulator{}, Selector: &NullSelector{}, BitsetCreate: &NullBitsetCreate{}, } }
go
func NewGeneticAlgorithm() GeneticAlgorithm { return GeneticAlgorithm{ EliteConsumer: &NullEliteConsumer{}, Mater: &NullMater{}, Simulator: &NullSimulator{}, Selector: &NullSelector{}, BitsetCreate: &NullBitsetCreate{}, } }
[ "func", "NewGeneticAlgorithm", "(", ")", "GeneticAlgorithm", "{", "return", "GeneticAlgorithm", "{", "EliteConsumer", ":", "&", "NullEliteConsumer", "{", "}", ",", "Mater", ":", "&", "NullMater", "{", "}", ",", "Simulator", ":", "&", "NullSimulator", "{", "}",...
// NewGeneticAlgorithm returns a new GeneticAlgorithm structure with null implementations of // EliteConsumer, Mater, Simulator, Selector and BitsetCreate
[ "NewGeneticAlgorithm", "returns", "a", "new", "GeneticAlgorithm", "structure", "with", "null", "implementations", "of", "EliteConsumer", "Mater", "Simulator", "Selector", "and", "BitsetCreate" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/genetic_algorithm.go#L32-L40
134,720
tomcraven/goga
genetic_algorithm.go
Init
func (ga *GeneticAlgorithm) Init(populationSize, parallelSimulations int) { ga.populationSize = populationSize ga.population = ga.createPopulation() ga.parallelSimulations = parallelSimulations ga.waitGroup = new(sync.WaitGroup) }
go
func (ga *GeneticAlgorithm) Init(populationSize, parallelSimulations int) { ga.populationSize = populationSize ga.population = ga.createPopulation() ga.parallelSimulations = parallelSimulations ga.waitGroup = new(sync.WaitGroup) }
[ "func", "(", "ga", "*", "GeneticAlgorithm", ")", "Init", "(", "populationSize", ",", "parallelSimulations", "int", ")", "{", "ga", ".", "populationSize", "=", "populationSize", "\n", "ga", ".", "population", "=", "ga", ".", "createPopulation", "(", ")", "\n"...
// Init initialises internal components, sets up the population size // and number of parallel simulations
[ "Init", "initialises", "internal", "components", "sets", "up", "the", "population", "size", "and", "number", "of", "parallel", "simulations" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/genetic_algorithm.go#L52-L59
134,721
tomcraven/goga
genetic_algorithm.go
Simulate
func (ga *GeneticAlgorithm) Simulate() bool { if ga.populationSize == 0 { return false } ga.beginSimulation() for i := 0; i < ga.populationSize; i++ { ga.onNewGenomeToSimulate(&ga.population[i]) } ga.syncSimulatingGenomes() ga.Simulator.OnEndSimulation() for { elite := ga.getElite() ga.Mater.OnElite(...
go
func (ga *GeneticAlgorithm) Simulate() bool { if ga.populationSize == 0 { return false } ga.beginSimulation() for i := 0; i < ga.populationSize; i++ { ga.onNewGenomeToSimulate(&ga.population[i]) } ga.syncSimulatingGenomes() ga.Simulator.OnEndSimulation() for { elite := ga.getElite() ga.Mater.OnElite(...
[ "func", "(", "ga", "*", "GeneticAlgorithm", ")", "Simulate", "(", ")", "bool", "{", "if", "ga", ".", "populationSize", "==", "0", "{", "return", "false", "\n", "}", "\n\n", "ga", ".", "beginSimulation", "(", ")", "\n", "for", "i", ":=", "0", ";", "...
// Simulate runs the genetic algorithm
[ "Simulate", "runs", "the", "genetic", "algorithm" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/genetic_algorithm.go#L117-L163
134,722
tomcraven/goga
selector.go
Go
func (s *selector) Go(genomeArray []IGenome, totalFitness int) *IGenome { for { for _, config := range s.selectorConfig { if rand.Float32() < config.P { return config.F(genomeArray, totalFitness) } } } }
go
func (s *selector) Go(genomeArray []IGenome, totalFitness int) *IGenome { for { for _, config := range s.selectorConfig { if rand.Float32() < config.P { return config.F(genomeArray, totalFitness) } } } }
[ "func", "(", "s", "*", "selector", ")", "Go", "(", "genomeArray", "[", "]", "IGenome", ",", "totalFitness", "int", ")", "*", "IGenome", "{", "for", "{", "for", "_", ",", "config", ":=", "range", "s", ".", "selectorConfig", "{", "if", "rand", ".", "...
// Go - cycles through the selector function probabilities until one returns a genome
[ "Go", "-", "cycles", "through", "the", "selector", "function", "probabilities", "until", "one", "returns", "a", "genome" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/selector.go#L43-L51
134,723
tomcraven/goga
selector.go
Roulette
func Roulette(genomeArray []IGenome, totalFitness int) *IGenome { if len(genomeArray) == 0 { panic("genome array contains no elements") } if totalFitness == 0 { randomIndex := rand.Intn(len(genomeArray)) return &genomeArray[randomIndex] } randomFitness := rand.Intn(totalFitness) for i := range genomeArra...
go
func Roulette(genomeArray []IGenome, totalFitness int) *IGenome { if len(genomeArray) == 0 { panic("genome array contains no elements") } if totalFitness == 0 { randomIndex := rand.Intn(len(genomeArray)) return &genomeArray[randomIndex] } randomFitness := rand.Intn(totalFitness) for i := range genomeArra...
[ "func", "Roulette", "(", "genomeArray", "[", "]", "IGenome", ",", "totalFitness", "int", ")", "*", "IGenome", "{", "if", "len", "(", "genomeArray", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "totalFitness", "==", "0"...
// Roulette is a selection function that selects a genome where genomes that have a higher fitness are more likely to be picked
[ "Roulette", "is", "a", "selection", "function", "that", "selects", "a", "genome", "where", "genomes", "that", "have", "a", "higher", "fitness", "are", "more", "likely", "to", "be", "picked" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/selector.go#L54-L74
134,724
tomcraven/goga
mater.go
Go
func (nm *NullMater) Go(a, b *IGenome) (IGenome, IGenome) { return NewGenome(*(*a).GetBits()), NewGenome(*(*b).GetBits()) }
go
func (nm *NullMater) Go(a, b *IGenome) (IGenome, IGenome) { return NewGenome(*(*a).GetBits()), NewGenome(*(*b).GetBits()) }
[ "func", "(", "nm", "*", "NullMater", ")", "Go", "(", "a", ",", "b", "*", "IGenome", ")", "(", "IGenome", ",", "IGenome", ")", "{", "return", "NewGenome", "(", "*", "(", "*", "a", ")", ".", "GetBits", "(", ")", ")", ",", "NewGenome", "(", "*", ...
// Go - null implementation of the IMater go func
[ "Go", "-", "null", "implementation", "of", "the", "IMater", "go", "func" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/mater.go#L18-L20
134,725
tomcraven/goga
mater.go
Go
func (m *mater) Go(g1, g2 *IGenome) (IGenome, IGenome) { newG1 := NewGenome(*(*g1).GetBits()) newG2 := NewGenome(*(*g2).GetBits()) for _, config := range m.materConfig { if rand.Float32() < config.P { if config.UseElite { newG1, newG2 = config.F(&newG1, m.elite) } else { newG1, newG2 = config.F(&new...
go
func (m *mater) Go(g1, g2 *IGenome) (IGenome, IGenome) { newG1 := NewGenome(*(*g1).GetBits()) newG2 := NewGenome(*(*g2).GetBits()) for _, config := range m.materConfig { if rand.Float32() < config.P { if config.UseElite { newG1, newG2 = config.F(&newG1, m.elite) } else { newG1, newG2 = config.F(&new...
[ "func", "(", "m", "*", "mater", ")", "Go", "(", "g1", ",", "g2", "*", "IGenome", ")", "(", "IGenome", ",", "IGenome", ")", "{", "newG1", ":=", "NewGenome", "(", "*", "(", "*", "g1", ")", ".", "GetBits", "(", ")", ")", "\n", "newG2", ":=", "Ne...
// Go cycles through, and applies, the configures mater functions in the // MaterFunctionProbability array
[ "Go", "cycles", "through", "and", "applies", "the", "configures", "mater", "functions", "in", "the", "MaterFunctionProbability", "array" ]
3b7915ecdd7bb6616dc3ceed450068e092ed87bc
https://github.com/tomcraven/goga/blob/3b7915ecdd7bb6616dc3ceed450068e092ed87bc/mater.go#L51-L66
134,726
alixaxel/pagerank
pagerank.go
NewGraph
func NewGraph() *Graph { return &Graph{ edges: make(map[uint32](map[uint32]float64)), nodes: make(map[uint32]*node), } }
go
func NewGraph() *Graph { return &Graph{ edges: make(map[uint32](map[uint32]float64)), nodes: make(map[uint32]*node), } }
[ "func", "NewGraph", "(", ")", "*", "Graph", "{", "return", "&", "Graph", "{", "edges", ":", "make", "(", "map", "[", "uint32", "]", "(", "map", "[", "uint32", "]", "float64", ")", ")", ",", "nodes", ":", "make", "(", "map", "[", "uint32", "]", ...
// NewGraph initializes and returns a new graph.
[ "NewGraph", "initializes", "and", "returns", "a", "new", "graph", "." ]
14bfb4c1d88cb4ca9df65cae8e530ab6b3cd74e4
https://github.com/alixaxel/pagerank/blob/14bfb4c1d88cb4ca9df65cae8e530ab6b3cd74e4/pagerank.go#L22-L27
134,727
alixaxel/pagerank
pagerank.go
Link
func (self *Graph) Link(source, target uint32, weight float64) { if _, ok := self.nodes[source]; ok == false { self.nodes[source] = &node{ weight: 0, outbound: 0, } } self.nodes[source].outbound += weight if _, ok := self.nodes[target]; ok == false { self.nodes[target] = &node{ weight: 0, ou...
go
func (self *Graph) Link(source, target uint32, weight float64) { if _, ok := self.nodes[source]; ok == false { self.nodes[source] = &node{ weight: 0, outbound: 0, } } self.nodes[source].outbound += weight if _, ok := self.nodes[target]; ok == false { self.nodes[target] = &node{ weight: 0, ou...
[ "func", "(", "self", "*", "Graph", ")", "Link", "(", "source", ",", "target", "uint32", ",", "weight", "float64", ")", "{", "if", "_", ",", "ok", ":=", "self", ".", "nodes", "[", "source", "]", ";", "ok", "==", "false", "{", "self", ".", "nodes",...
// Link creates a weighted edge between a source-target node pair. // If the edge already exists, the weight is incremented.
[ "Link", "creates", "a", "weighted", "edge", "between", "a", "source", "-", "target", "node", "pair", ".", "If", "the", "edge", "already", "exists", "the", "weight", "is", "incremented", "." ]
14bfb4c1d88cb4ca9df65cae8e530ab6b3cd74e4
https://github.com/alixaxel/pagerank/blob/14bfb4c1d88cb4ca9df65cae8e530ab6b3cd74e4/pagerank.go#L31-L53
134,728
alixaxel/pagerank
pagerank.go
Reset
func (self *Graph) Reset() { self.edges = make(map[uint32](map[uint32]float64)) self.nodes = make(map[uint32]*node) }
go
func (self *Graph) Reset() { self.edges = make(map[uint32](map[uint32]float64)) self.nodes = make(map[uint32]*node) }
[ "func", "(", "self", "*", "Graph", ")", "Reset", "(", ")", "{", "self", ".", "edges", "=", "make", "(", "map", "[", "uint32", "]", "(", "map", "[", "uint32", "]", "float64", ")", ")", "\n", "self", ".", "nodes", "=", "make", "(", "map", "[", ...
// Reset clears all the current graph data.
[ "Reset", "clears", "all", "the", "current", "graph", "data", "." ]
14bfb4c1d88cb4ca9df65cae8e530ab6b3cd74e4
https://github.com/alixaxel/pagerank/blob/14bfb4c1d88cb4ca9df65cae8e530ab6b3cd74e4/pagerank.go#L114-L117
134,729
cloudfoundry-incubator/credhub-cli
credhub/get.go
GetById
func (ch *CredHub) GetById(id string) (credentials.Credential, error) { var cred credentials.Credential err := ch.makeCredentialGetByIdRequest(id, &cred) return cred, err }
go
func (ch *CredHub) GetById(id string) (credentials.Credential, error) { var cred credentials.Credential err := ch.makeCredentialGetByIdRequest(id, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GetById", "(", "id", "string", ")", "(", "credentials", ".", "Credential", ",", "error", ")", "{", "var", "cred", "credentials", ".", "Credential", "\n\n", "err", ":=", "ch", ".", "makeCredentialGetByIdRequest", "("...
// GetById returns a credential version by ID. The returned credential will be encoded as a map and may be of any type.
[ "GetById", "returns", "a", "credential", "version", "by", "ID", ".", "The", "returned", "credential", "will", "be", "encoded", "as", "a", "map", "and", "may", "be", "of", "any", "type", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/get.go#L17-L23
134,730
cloudfoundry-incubator/credhub-cli
credhub/get.go
GetAllVersions
func (ch *CredHub) GetAllVersions(name string) ([]credentials.Credential, error) { query := url.Values{} query.Set("name", name) return ch.makeMultiCredentialGetRequest(query) }
go
func (ch *CredHub) GetAllVersions(name string) ([]credentials.Credential, error) { query := url.Values{} query.Set("name", name) return ch.makeMultiCredentialGetRequest(query) }
[ "func", "(", "ch", "*", "CredHub", ")", "GetAllVersions", "(", "name", "string", ")", "(", "[", "]", "credentials", ".", "Credential", ",", "error", ")", "{", "query", ":=", "url", ".", "Values", "{", "}", "\n", "query", ".", "Set", "(", "\"", "\""...
// GetAllVersions returns all credential versions for a given credential name. The returned credentials will be encoded as a list of maps and may be of any type.
[ "GetAllVersions", "returns", "all", "credential", "versions", "for", "a", "given", "credential", "name", ".", "The", "returned", "credentials", "will", "be", "encoded", "as", "a", "list", "of", "maps", "and", "may", "be", "of", "any", "type", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/get.go#L26-L31
134,731
cloudfoundry-incubator/credhub-cli
credhub/get.go
GetNVersions
func (ch *CredHub) GetNVersions(name string, numberOfVersions int) ([]credentials.Credential, error) { creds, err := ch.getNVersionsOfCredential(name, numberOfVersions) return creds, err }
go
func (ch *CredHub) GetNVersions(name string, numberOfVersions int) ([]credentials.Credential, error) { creds, err := ch.getNVersionsOfCredential(name, numberOfVersions) return creds, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GetNVersions", "(", "name", "string", ",", "numberOfVersions", "int", ")", "(", "[", "]", "credentials", ".", "Credential", ",", "error", ")", "{", "creds", ",", "err", ":=", "ch", ".", "getNVersionsOfCredential", ...
// GetNVersions returns the N most recent credential versions for a given credential name. The returned credentials will be encoded as a list of maps and may be of any type.
[ "GetNVersions", "returns", "the", "N", "most", "recent", "credential", "versions", "for", "a", "given", "credential", "name", ".", "The", "returned", "credentials", "will", "be", "encoded", "as", "a", "list", "of", "maps", "and", "may", "be", "of", "any", ...
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/get.go#L41-L44
134,732
cloudfoundry-incubator/credhub-cli
credhub/info.go
Info
func (ch *CredHub) Info() (*server.Info, error) { //This uses a the private 'request' as it makes an https call but it does not require authentication response, err := ch.request(ch.Client(), "GET", "/info", nil, nil, true) if err != nil { return nil, err } defer response.Body.Close() defer io.Copy(ioutil.Disc...
go
func (ch *CredHub) Info() (*server.Info, error) { //This uses a the private 'request' as it makes an https call but it does not require authentication response, err := ch.request(ch.Client(), "GET", "/info", nil, nil, true) if err != nil { return nil, err } defer response.Body.Close() defer io.Copy(ioutil.Disc...
[ "func", "(", "ch", "*", "CredHub", ")", "Info", "(", ")", "(", "*", "server", ".", "Info", ",", "error", ")", "{", "//This uses a the private 'request' as it makes an https call but it does not require authentication", "response", ",", "err", ":=", "ch", ".", "reque...
// Info returns the targeted CredHub server information.
[ "Info", "returns", "the", "targeted", "CredHub", "server", "information", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/info.go#L13-L31
134,733
cloudfoundry-incubator/credhub-cli
credhub/info.go
AuthURL
func (ch *CredHub) AuthURL() (string, error) { if ch.authURL != nil { return ch.authURL.String(), nil } info, err := ch.Info() if err != nil { return "", err } authURL := info.AuthServer.URL if authURL == "" { return "", errors.New("AuthURL not found") } return authURL, nil }
go
func (ch *CredHub) AuthURL() (string, error) { if ch.authURL != nil { return ch.authURL.String(), nil } info, err := ch.Info() if err != nil { return "", err } authURL := info.AuthServer.URL if authURL == "" { return "", errors.New("AuthURL not found") } return authURL, nil }
[ "func", "(", "ch", "*", "CredHub", ")", "AuthURL", "(", ")", "(", "string", ",", "error", ")", "{", "if", "ch", ".", "authURL", "!=", "nil", "{", "return", "ch", ".", "authURL", ".", "String", "(", ")", ",", "nil", "\n", "}", "\n\n", "info", ",...
// AuthURL returns the targeted CredHub server's trusted authentication server URL.
[ "AuthURL", "returns", "the", "targeted", "CredHub", "server", "s", "trusted", "authentication", "server", "URL", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/info.go#L34-L52
134,734
cloudfoundry-incubator/credhub-cli
credhub/client.go
Client
func (ch *CredHub) Client() *http.Client { if ch.defaultClient == nil { ch.defaultClient = ch.client() } return ch.defaultClient }
go
func (ch *CredHub) Client() *http.Client { if ch.defaultClient == nil { ch.defaultClient = ch.client() } return ch.defaultClient }
[ "func", "(", "ch", "*", "CredHub", ")", "Client", "(", ")", "*", "http", ".", "Client", "{", "if", "ch", ".", "defaultClient", "==", "nil", "{", "ch", ".", "defaultClient", "=", "ch", ".", "client", "(", ")", "\n", "}", "\n\n", "return", "ch", "....
// Client provides an unauthenticated http.Client to the CredHub server
[ "Client", "provides", "an", "unauthenticated", "http", ".", "Client", "to", "the", "CredHub", "server" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/client.go#L14-L20
134,735
cloudfoundry-incubator/credhub-cli
credhub/auth/oauth.go
Do
func (a *OAuthStrategy) Do(req *http.Request) (*http.Response, error) { if err := a.Login(); err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+a.AccessToken()) clone, err := cloneRequest(req) if err != nil { return nil, errors.New("failed to clone request body: " + err.Error()) } r...
go
func (a *OAuthStrategy) Do(req *http.Request) (*http.Response, error) { if err := a.Login(); err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+a.AccessToken()) clone, err := cloneRequest(req) if err != nil { return nil, errors.New("failed to clone request body: " + err.Error()) } r...
[ "func", "(", "a", "*", "OAuthStrategy", ")", "Do", "(", "req", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "if", "err", ":=", "a", ".", "Login", "(", ")", ";", "err", "!=", "nil", "{", "return", ...
// Do submits requests with bearer token authorization, using the AccessToken as the bearer token. // // Will automatically refresh the AccessToken and retry the request if the token has expired.
[ "Do", "submits", "requests", "with", "bearer", "token", "authorization", "using", "the", "AccessToken", "as", "the", "bearer", "token", ".", "Will", "automatically", "refresh", "the", "AccessToken", "and", "retry", "the", "request", "if", "the", "token", "has", ...
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/oauth.go#L39-L71
134,736
cloudfoundry-incubator/credhub-cli
credhub/auth/oauth.go
Refresh
func (a *OAuthStrategy) Refresh() error { refreshToken := a.RefreshToken() if refreshToken == "" { return a.requestToken() } var accessToken string var err error if a.ClientCredentialRefresh { accessToken, err = a.OAuthClient.ClientCredentialGrant(a.ClientId, a.ClientSecret) } else { accessToken, refres...
go
func (a *OAuthStrategy) Refresh() error { refreshToken := a.RefreshToken() if refreshToken == "" { return a.requestToken() } var accessToken string var err error if a.ClientCredentialRefresh { accessToken, err = a.OAuthClient.ClientCredentialGrant(a.ClientId, a.ClientSecret) } else { accessToken, refres...
[ "func", "(", "a", "*", "OAuthStrategy", ")", "Refresh", "(", ")", "error", "{", "refreshToken", ":=", "a", ".", "RefreshToken", "(", ")", "\n\n", "if", "refreshToken", "==", "\"", "\"", "{", "return", "a", ".", "requestToken", "(", ")", "\n", "}", "\...
// Refresh will get a new AccessToken // // If RefreshToken is available, a refresh token grant will be used, otherwise // client credential grant will be used.
[ "Refresh", "will", "get", "a", "new", "AccessToken", "If", "RefreshToken", "is", "available", "a", "refresh", "token", "grant", "will", "be", "used", "otherwise", "client", "credential", "grant", "will", "be", "used", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/oauth.go#L77-L103
134,737
cloudfoundry-incubator/credhub-cli
credhub/auth/oauth.go
Logout
func (a *OAuthStrategy) Logout() error { accessToken := a.AccessToken() if accessToken == "" { return nil } if err := a.OAuthClient.RevokeToken(a.AccessToken()); err != nil { return err } a.SetTokens("", "") return nil }
go
func (a *OAuthStrategy) Logout() error { accessToken := a.AccessToken() if accessToken == "" { return nil } if err := a.OAuthClient.RevokeToken(a.AccessToken()); err != nil { return err } a.SetTokens("", "") return nil }
[ "func", "(", "a", "*", "OAuthStrategy", ")", "Logout", "(", ")", "error", "{", "accessToken", ":=", "a", ".", "AccessToken", "(", ")", "\n\n", "if", "accessToken", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "a", "...
// Logout will send a revoke token request // // On success, the AccessToken and RefreshToken will be empty
[ "Logout", "will", "send", "a", "revoke", "token", "request", "On", "success", "the", "AccessToken", "and", "RefreshToken", "will", "be", "empty" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/oauth.go#L108-L122
134,738
cloudfoundry-incubator/credhub-cli
credhub/auth/oauth.go
AccessToken
func (a *OAuthStrategy) AccessToken() string { a.mu.RLock() defer a.mu.RUnlock() return a.accessToken }
go
func (a *OAuthStrategy) AccessToken() string { a.mu.RLock() defer a.mu.RUnlock() return a.accessToken }
[ "func", "(", "a", "*", "OAuthStrategy", ")", "AccessToken", "(", ")", "string", "{", "a", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "mu", ".", "RUnlock", "(", ")", "\n\n", "return", "a", ".", "accessToken", "\n", "}" ]
// AccessToken is the Bearer token to be used for authenticated requests
[ "AccessToken", "is", "the", "Bearer", "token", "to", "be", "used", "for", "authenticated", "requests" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/oauth.go#L161-L166
134,739
cloudfoundry-incubator/credhub-cli
credhub/auth/oauth.go
SetTokens
func (a *OAuthStrategy) SetTokens(access, refresh string) { a.mu.Lock() defer a.mu.Unlock() a.accessToken = access a.refreshToken = refresh }
go
func (a *OAuthStrategy) SetTokens(access, refresh string) { a.mu.Lock() defer a.mu.Unlock() a.accessToken = access a.refreshToken = refresh }
[ "func", "(", "a", "*", "OAuthStrategy", ")", "SetTokens", "(", "access", ",", "refresh", "string", ")", "{", "a", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "a", ".", "accessToken", "=", "acc...
// SetToken sets the AccessToken and RefreshTokens
[ "SetToken", "sets", "the", "AccessToken", "and", "RefreshTokens" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/oauth.go#L178-L184
134,740
cloudfoundry-incubator/credhub-cli
credhub/regenerate.go
Regenerate
func (ch *CredHub) Regenerate(name string) (credentials.Credential, error) { var cred credentials.Credential regenerateEndpoint := "/api/v1/data" requestBody := map[string]interface{}{} requestBody["name"] = name requestBody["regenerate"] = true resp, err := ch.Request(http.MethodPost, regenerateEndpoint, nil,...
go
func (ch *CredHub) Regenerate(name string) (credentials.Credential, error) { var cred credentials.Credential regenerateEndpoint := "/api/v1/data" requestBody := map[string]interface{}{} requestBody["name"] = name requestBody["regenerate"] = true resp, err := ch.Request(http.MethodPost, regenerateEndpoint, nil,...
[ "func", "(", "ch", "*", "CredHub", ")", "Regenerate", "(", "name", "string", ")", "(", "credentials", ".", "Credential", ",", "error", ")", "{", "var", "cred", "credentials", ".", "Credential", "\n\n", "regenerateEndpoint", ":=", "\"", "\"", "\n\n", "reque...
// Regenerate generates and returns a new credential version using the same parameters existing credential. The returned credential may be of any type.
[ "Regenerate", "generates", "and", "returns", "a", "new", "credential", "version", "using", "the", "same", "parameters", "existing", "credential", ".", "The", "returned", "credential", "may", "be", "of", "any", "type", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/regenerate.go#L13-L34
134,741
cloudfoundry-incubator/credhub-cli
credhub/auth/builders.go
UaaPassword
func UaaPassword(clientId, clientSecret, username, password string) Builder { return Uaa(clientId, clientSecret, username, password, "", "", false) }
go
func UaaPassword(clientId, clientSecret, username, password string) Builder { return Uaa(clientId, clientSecret, username, password, "", "", false) }
[ "func", "UaaPassword", "(", "clientId", ",", "clientSecret", ",", "username", ",", "password", "string", ")", "Builder", "{", "return", "Uaa", "(", "clientId", ",", "clientSecret", ",", "username", ",", "password", ",", "\"", "\"", ",", "\"", "\"", ",", ...
// UaaPassword builds an OauthStrategy for UAA using password_grant token requests
[ "UaaPassword", "builds", "an", "OauthStrategy", "for", "UAA", "using", "password_grant", "token", "requests" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/builders.go#L28-L30
134,742
cloudfoundry-incubator/credhub-cli
credhub/auth/builders.go
Uaa
func Uaa(clientId, clientSecret, username, password, accessToken, refreshToken string, usingClientCrendentials bool) Builder { return func(config Config) (Strategy, error) { httpClient := config.Client() authUrl, err := config.AuthURL() if err != nil { return nil, err } uaaClient := uaa.Client{ AuthU...
go
func Uaa(clientId, clientSecret, username, password, accessToken, refreshToken string, usingClientCrendentials bool) Builder { return func(config Config) (Strategy, error) { httpClient := config.Client() authUrl, err := config.AuthURL() if err != nil { return nil, err } uaaClient := uaa.Client{ AuthU...
[ "func", "Uaa", "(", "clientId", ",", "clientSecret", ",", "username", ",", "password", ",", "accessToken", ",", "refreshToken", "string", ",", "usingClientCrendentials", "bool", ")", "Builder", "{", "return", "func", "(", "config", "Config", ")", "(", "Strateg...
// Uaa builds an OauthStrategy for a UAA using existing tokens
[ "Uaa", "builds", "an", "OauthStrategy", "for", "a", "UAA", "using", "existing", "tokens" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/builders.go#L38-L66
134,743
cloudfoundry-incubator/credhub-cli
credhub/find.go
FindByPartialName
func (ch *CredHub) FindByPartialName(nameLike string) (credentials.FindResults, error) { return ch.findByPathOrNameLike("name-like", nameLike) }
go
func (ch *CredHub) FindByPartialName(nameLike string) (credentials.FindResults, error) { return ch.findByPathOrNameLike("name-like", nameLike) }
[ "func", "(", "ch", "*", "CredHub", ")", "FindByPartialName", "(", "nameLike", "string", ")", "(", "credentials", ".", "FindResults", ",", "error", ")", "{", "return", "ch", ".", "findByPathOrNameLike", "(", "\"", "\"", ",", "nameLike", ")", "\n", "}" ]
// FindByPartialName retrieves a list of stored credential names which contain the search.
[ "FindByPartialName", "retrieves", "a", "list", "of", "stored", "credential", "names", "which", "contain", "the", "search", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/find.go#L13-L15
134,744
cloudfoundry-incubator/credhub-cli
credhub/find.go
FindByPath
func (ch *CredHub) FindByPath(path string) (credentials.FindResults, error) { return ch.findByPathOrNameLike("path", path) }
go
func (ch *CredHub) FindByPath(path string) (credentials.FindResults, error) { return ch.findByPathOrNameLike("path", path) }
[ "func", "(", "ch", "*", "CredHub", ")", "FindByPath", "(", "path", "string", ")", "(", "credentials", ".", "FindResults", ",", "error", ")", "{", "return", "ch", ".", "findByPathOrNameLike", "(", "\"", "\"", ",", "path", ")", "\n", "}" ]
// FindByPath retrieves a list of stored credential names which are within the specified path.
[ "FindByPath", "retrieves", "a", "list", "of", "stored", "credential", "names", "which", "are", "within", "the", "specified", "path", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/find.go#L18-L20
134,745
cloudfoundry-incubator/credhub-cli
credhub/new.go
New
func New(target string, options ...Option) (*CredHub, error) { baseURL, err := url.Parse(target) if err != nil { return nil, err } credhub := &CredHub{ ApiURL: target, baseURL: baseURL, authBuilder: auth.Noop, } for _, option := range options { if err := option(credhub); err != nil { retu...
go
func New(target string, options ...Option) (*CredHub, error) { baseURL, err := url.Parse(target) if err != nil { return nil, err } credhub := &CredHub{ ApiURL: target, baseURL: baseURL, authBuilder: auth.Noop, } for _, option := range options { if err := option(credhub); err != nil { retu...
[ "func", "New", "(", "target", "string", ",", "options", "...", "Option", ")", "(", "*", "CredHub", ",", "error", ")", "{", "baseURL", ",", "err", ":=", "url", ".", "Parse", "(", "target", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil",...
// New provides a CredHub API client for the target server. Options can be // provided to specify additional parameters, including authentication. // See the Option type for a list of supported options. // // When targeting multiple CredHub servers, use a new CredHub API client // for each target server.
[ "New", "provides", "a", "CredHub", "API", "client", "for", "the", "target", "server", ".", "Options", "can", "be", "provided", "to", "specify", "additional", "parameters", "including", "authentication", ".", "See", "the", "Option", "type", "for", "a", "list", ...
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/new.go#L15-L40
134,746
cloudfoundry-incubator/credhub-cli
credhub/auth/uaa/client.go
ClientCredentialGrant
func (u *Client) ClientCredentialGrant(clientId, clientSecret string) (string, error) { values := url.Values{ "grant_type": {"client_credentials"}, "response_type": {"token"}, "client_id": {clientId}, "client_secret": {clientSecret}, } token, err := u.tokenGrantRequest(values) return token.AccessTo...
go
func (u *Client) ClientCredentialGrant(clientId, clientSecret string) (string, error) { values := url.Values{ "grant_type": {"client_credentials"}, "response_type": {"token"}, "client_id": {clientId}, "client_secret": {clientSecret}, } token, err := u.tokenGrantRequest(values) return token.AccessTo...
[ "func", "(", "u", "*", "Client", ")", "ClientCredentialGrant", "(", "clientId", ",", "clientSecret", "string", ")", "(", "string", ",", "error", ")", "{", "values", ":=", "url", ".", "Values", "{", "\"", "\"", ":", "{", "\"", "\"", "}", ",", "\"", ...
// ClientCredentialGrant requests a token using client_credentials grant type
[ "ClientCredentialGrant", "requests", "a", "token", "using", "client_credentials", "grant", "type" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/uaa/client.go#L99-L110
134,747
cloudfoundry-incubator/credhub-cli
credhub/auth/uaa/client.go
PasswordGrant
func (u *Client) PasswordGrant(clientId, clientSecret, username, password string) (string, string, error) { values := url.Values{ "grant_type": {"password"}, "response_type": {"token"}, "username": {username}, "password": {password}, "client_id": {clientId}, "client_secret": {clientSecret}...
go
func (u *Client) PasswordGrant(clientId, clientSecret, username, password string) (string, string, error) { values := url.Values{ "grant_type": {"password"}, "response_type": {"token"}, "username": {username}, "password": {password}, "client_id": {clientId}, "client_secret": {clientSecret}...
[ "func", "(", "u", "*", "Client", ")", "PasswordGrant", "(", "clientId", ",", "clientSecret", ",", "username", ",", "password", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "values", ":=", "url", ".", "Values", "{", "\"", "\"", ...
// PasswordGrant requests an access token and refresh token using password grant type
[ "PasswordGrant", "requests", "an", "access", "token", "and", "refresh", "token", "using", "password", "grant", "type" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/uaa/client.go#L113-L126
134,748
cloudfoundry-incubator/credhub-cli
credhub/auth/uaa/client.go
PasscodeGrant
func (u *Client) PasscodeGrant(clientId, clientSecret, passcode string) (string, string, error) { values := url.Values{ "grant_type": {"password"}, "response_type": {"token"}, "passcode": {passcode}, "client_id": {clientId}, "client_secret": {clientSecret}, } token, err := u.tokenGrantRequest(...
go
func (u *Client) PasscodeGrant(clientId, clientSecret, passcode string) (string, string, error) { values := url.Values{ "grant_type": {"password"}, "response_type": {"token"}, "passcode": {passcode}, "client_id": {clientId}, "client_secret": {clientSecret}, } token, err := u.tokenGrantRequest(...
[ "func", "(", "u", "*", "Client", ")", "PasscodeGrant", "(", "clientId", ",", "clientSecret", ",", "passcode", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "values", ":=", "url", ".", "Values", "{", "\"", "\"", ":", "{", "\"", ...
// PasscodeGrant requests an access token and refresh token using passcode grant type
[ "PasscodeGrant", "requests", "an", "access", "token", "and", "refresh", "token", "using", "passcode", "grant", "type" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/uaa/client.go#L129-L141
134,749
cloudfoundry-incubator/credhub-cli
credhub/auth/uaa/client.go
RefreshTokenGrant
func (u *Client) RefreshTokenGrant(clientId, clientSecret, refreshToken string) (string, string, error) { values := url.Values{ "grant_type": {"refresh_token"}, "response_type": {"token"}, "client_id": {clientId}, "client_secret": {clientSecret}, "refresh_token": {refreshToken}, } token, err := u.t...
go
func (u *Client) RefreshTokenGrant(clientId, clientSecret, refreshToken string) (string, string, error) { values := url.Values{ "grant_type": {"refresh_token"}, "response_type": {"token"}, "client_id": {clientId}, "client_secret": {clientSecret}, "refresh_token": {refreshToken}, } token, err := u.t...
[ "func", "(", "u", "*", "Client", ")", "RefreshTokenGrant", "(", "clientId", ",", "clientSecret", ",", "refreshToken", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "values", ":=", "url", ".", "Values", "{", "\"", "\"", ":", "{", ...
// RefreshTokenGrant requests a new access token and refresh token using refresh_token grant type
[ "RefreshTokenGrant", "requests", "a", "new", "access", "token", "and", "refresh", "token", "using", "refresh_token", "grant", "type" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/uaa/client.go#L144-L156
134,750
cloudfoundry-incubator/credhub-cli
credhub/auth/uaa/client.go
RevokeToken
func (u *Client) RevokeToken(accessToken string) error { segments := strings.Split(accessToken, ".") if len(segments) < 2 { return errors.New("access token missing segments") } jsonPayload, err := base64.RawURLEncoding.DecodeString(segments[1]) if err != nil { return errors.New("could not base64 decode toke...
go
func (u *Client) RevokeToken(accessToken string) error { segments := strings.Split(accessToken, ".") if len(segments) < 2 { return errors.New("access token missing segments") } jsonPayload, err := base64.RawURLEncoding.DecodeString(segments[1]) if err != nil { return errors.New("could not base64 decode toke...
[ "func", "(", "u", "*", "Client", ")", "RevokeToken", "(", "accessToken", "string", ")", "error", "{", "segments", ":=", "strings", ".", "Split", "(", "accessToken", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "segments", ")", "<", "2", "{", "retu...
// RevokeToken revokes the given access token
[ "RevokeToken", "revokes", "the", "given", "access", "token" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/auth/uaa/client.go#L191-L232
134,751
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetValue
func (ch *CredHub) SetValue(name string, value values.Value) (credentials.Value, error) { var cred credentials.Value err := ch.setCredential(name, "value", value, &cred) return cred, err }
go
func (ch *CredHub) SetValue(name string, value values.Value) (credentials.Value, error) { var cred credentials.Value err := ch.setCredential(name, "value", value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetValue", "(", "name", "string", ",", "value", "values", ".", "Value", ")", "(", "credentials", ".", "Value", ",", "error", ")", "{", "var", "cred", "credentials", ".", "Value", "\n", "err", ":=", "ch", ".", ...
// SetValue sets a value credential with a user-provided value.
[ "SetValue", "sets", "a", "value", "credential", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L14-L19
134,752
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetJSON
func (ch *CredHub) SetJSON(name string, value values.JSON) (credentials.JSON, error) { var cred credentials.JSON err := ch.setCredential(name, "json", value, &cred) return cred, err }
go
func (ch *CredHub) SetJSON(name string, value values.JSON) (credentials.JSON, error) { var cred credentials.JSON err := ch.setCredential(name, "json", value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetJSON", "(", "name", "string", ",", "value", "values", ".", "JSON", ")", "(", "credentials", ".", "JSON", ",", "error", ")", "{", "var", "cred", "credentials", ".", "JSON", "\n", "err", ":=", "ch", ".", "s...
// SetJSON sets a JSON credential with a user-provided value.
[ "SetJSON", "sets", "a", "JSON", "credential", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L22-L27
134,753
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetPassword
func (ch *CredHub) SetPassword(name string, value values.Password) (credentials.Password, error) { var cred credentials.Password err := ch.setCredential(name, "password", value, &cred) return cred, err }
go
func (ch *CredHub) SetPassword(name string, value values.Password) (credentials.Password, error) { var cred credentials.Password err := ch.setCredential(name, "password", value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetPassword", "(", "name", "string", ",", "value", "values", ".", "Password", ")", "(", "credentials", ".", "Password", ",", "error", ")", "{", "var", "cred", "credentials", ".", "Password", "\n", "err", ":=", "...
// SetPassword sets a password credential with a user-provided value.
[ "SetPassword", "sets", "a", "password", "credential", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L30-L35
134,754
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetUser
func (ch *CredHub) SetUser(name string, value values.User) (credentials.User, error) { var cred credentials.User err := ch.setCredential(name, "user", value, &cred) return cred, err }
go
func (ch *CredHub) SetUser(name string, value values.User) (credentials.User, error) { var cred credentials.User err := ch.setCredential(name, "user", value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetUser", "(", "name", "string", ",", "value", "values", ".", "User", ")", "(", "credentials", ".", "User", ",", "error", ")", "{", "var", "cred", "credentials", ".", "User", "\n", "err", ":=", "ch", ".", "s...
// SetUser sets a user credential with a user-provided value.
[ "SetUser", "sets", "a", "user", "credential", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L38-L43
134,755
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetCertificate
func (ch *CredHub) SetCertificate(name string, value values.Certificate) (credentials.Certificate, error) { var cred credentials.Certificate err := ch.setCredential(name, "certificate", value, &cred) return cred, err }
go
func (ch *CredHub) SetCertificate(name string, value values.Certificate) (credentials.Certificate, error) { var cred credentials.Certificate err := ch.setCredential(name, "certificate", value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetCertificate", "(", "name", "string", ",", "value", "values", ".", "Certificate", ")", "(", "credentials", ".", "Certificate", ",", "error", ")", "{", "var", "cred", "credentials", ".", "Certificate", "\n", "err",...
// SetCertificate sets a certificate credential with a user-provided value.
[ "SetCertificate", "sets", "a", "certificate", "credential", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L46-L51
134,756
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetRSA
func (ch *CredHub) SetRSA(name string, value values.RSA) (credentials.RSA, error) { var cred credentials.RSA err := ch.setCredential(name, "rsa", value, &cred) return cred, err }
go
func (ch *CredHub) SetRSA(name string, value values.RSA) (credentials.RSA, error) { var cred credentials.RSA err := ch.setCredential(name, "rsa", value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetRSA", "(", "name", "string", ",", "value", "values", ".", "RSA", ")", "(", "credentials", ".", "RSA", ",", "error", ")", "{", "var", "cred", "credentials", ".", "RSA", "\n", "err", ":=", "ch", ".", "setCr...
// SetRSA sets an RSA credential with a user-provided value.
[ "SetRSA", "sets", "an", "RSA", "credential", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L54-L59
134,757
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetSSH
func (ch *CredHub) SetSSH(name string, value values.SSH) (credentials.SSH, error) { var cred credentials.SSH err := ch.setCredential(name, "ssh", value, &cred) return cred, err }
go
func (ch *CredHub) SetSSH(name string, value values.SSH) (credentials.SSH, error) { var cred credentials.SSH err := ch.setCredential(name, "ssh", value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetSSH", "(", "name", "string", ",", "value", "values", ".", "SSH", ")", "(", "credentials", ".", "SSH", ",", "error", ")", "{", "var", "cred", "credentials", ".", "SSH", "\n", "err", ":=", "ch", ".", "setCr...
// SetSSH sets an SSH credential with a user-provided value.
[ "SetSSH", "sets", "an", "SSH", "credential", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L62-L67
134,758
cloudfoundry-incubator/credhub-cli
credhub/set.go
SetCredential
func (ch *CredHub) SetCredential(name, credType string, value interface{}) (credentials.Credential, error) { var cred credentials.Credential err := ch.setCredential(name, credType, value, &cred) return cred, err }
go
func (ch *CredHub) SetCredential(name, credType string, value interface{}) (credentials.Credential, error) { var cred credentials.Credential err := ch.setCredential(name, credType, value, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "SetCredential", "(", "name", ",", "credType", "string", ",", "value", "interface", "{", "}", ")", "(", "credentials", ".", "Credential", ",", "error", ")", "{", "var", "cred", "credentials", ".", "Credential", "\n...
// SetCredential sets a credential of any type with a user-provided value.
[ "SetCredential", "sets", "a", "credential", "of", "any", "type", "with", "a", "user", "-", "provided", "value", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/set.go#L70-L75
134,759
cloudfoundry-incubator/credhub-cli
credhub/delete.go
Delete
func (ch *CredHub) Delete(name string) error { query := url.Values{} query.Set("name", name) resp, err := ch.Request(http.MethodDelete, "/api/v1/data", query, nil, true) if err == nil { defer resp.Body.Close() } return err }
go
func (ch *CredHub) Delete(name string) error { query := url.Values{} query.Set("name", name) resp, err := ch.Request(http.MethodDelete, "/api/v1/data", query, nil, true) if err == nil { defer resp.Body.Close() } return err }
[ "func", "(", "ch", "*", "CredHub", ")", "Delete", "(", "name", "string", ")", "error", "{", "query", ":=", "url", ".", "Values", "{", "}", "\n", "query", ".", "Set", "(", "\"", "\"", ",", "name", ")", "\n", "resp", ",", "err", ":=", "ch", ".", ...
// Delete will delete all versions of a credential by name
[ "Delete", "will", "delete", "all", "versions", "of", "a", "credential", "by", "name" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/delete.go#L9-L19
134,760
cloudfoundry-incubator/credhub-cli
credhub/options.go
Auth
func Auth(method auth.Builder) Option { return func(c *CredHub) error { c.authBuilder = method return nil } }
go
func Auth(method auth.Builder) Option { return func(c *CredHub) error { c.authBuilder = method return nil } }
[ "func", "Auth", "(", "method", "auth", ".", "Builder", ")", "Option", "{", "return", "func", "(", "c", "*", "CredHub", ")", "error", "{", "c", ".", "authBuilder", "=", "method", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// Auth specifies the authentication Strategy. See the auth package // for a full list of supported strategies.
[ "Auth", "specifies", "the", "authentication", "Strategy", ".", "See", "the", "auth", "package", "for", "a", "full", "list", "of", "supported", "strategies", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/options.go#L19-L24
134,761
cloudfoundry-incubator/credhub-cli
credhub/options.go
CaCerts
func CaCerts(certs ...string) Option { return func(c *CredHub) error { // TODO: remove else block once x509.SystemCertPool is supported on Windows // see: https://github.com/golang/go/issues/16736 var pool *x509.CertPool if runtime.GOOS != "windows" { var err error pool, err = x509.SystemCertPool() if...
go
func CaCerts(certs ...string) Option { return func(c *CredHub) error { // TODO: remove else block once x509.SystemCertPool is supported on Windows // see: https://github.com/golang/go/issues/16736 var pool *x509.CertPool if runtime.GOOS != "windows" { var err error pool, err = x509.SystemCertPool() if...
[ "func", "CaCerts", "(", "certs", "...", "string", ")", "Option", "{", "return", "func", "(", "c", "*", "CredHub", ")", "error", "{", "// TODO: remove else block once x509.SystemCertPool is supported on Windows", "// see: https://github.com/golang/go/issues/16736", "var", "p...
// CaCerts specifies the root certificates for HTTPS connections with the CredHub server. // // If the OAuthStrategy is used for Auth, the root certificates will also be used for HTTPS // connections with the OAuth server.
[ "CaCerts", "specifies", "the", "root", "certificates", "for", "HTTPS", "connections", "with", "the", "CredHub", "server", ".", "If", "the", "OAuthStrategy", "is", "used", "for", "Auth", "the", "root", "certificates", "will", "also", "be", "used", "for", "HTTPS...
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/options.go#L43-L68
134,762
cloudfoundry-incubator/credhub-cli
credhub/options.go
SkipTLSValidation
func SkipTLSValidation(skipTLSvalidation bool) Option { return func(c *CredHub) error { c.insecureSkipVerify = skipTLSvalidation return nil } }
go
func SkipTLSValidation(skipTLSvalidation bool) Option { return func(c *CredHub) error { c.insecureSkipVerify = skipTLSvalidation return nil } }
[ "func", "SkipTLSValidation", "(", "skipTLSvalidation", "bool", ")", "Option", "{", "return", "func", "(", "c", "*", "CredHub", ")", "error", "{", "c", ".", "insecureSkipVerify", "=", "skipTLSvalidation", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// SkipTLSValidation will skip root certificate verification for HTTPS. Not recommended!
[ "SkipTLSValidation", "will", "skip", "root", "certificate", "verification", "for", "HTTPS", ".", "Not", "recommended!" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/options.go#L71-L76
134,763
cloudfoundry-incubator/credhub-cli
credhub/options.go
ClientCert
func ClientCert(certificate, key string) Option { return func(c *CredHub) error { cert, err := tls.LoadX509KeyPair(certificate, key) if err != nil { return err } c.clientCertificate = &cert return nil } }
go
func ClientCert(certificate, key string) Option { return func(c *CredHub) error { cert, err := tls.LoadX509KeyPair(certificate, key) if err != nil { return err } c.clientCertificate = &cert return nil } }
[ "func", "ClientCert", "(", "certificate", ",", "key", "string", ")", "Option", "{", "return", "func", "(", "c", "*", "CredHub", ")", "error", "{", "cert", ",", "err", ":=", "tls", ".", "LoadX509KeyPair", "(", "certificate", ",", "key", ")", "\n", "if",...
// ClientCert will use a certificate for authentication
[ "ClientCert", "will", "use", "a", "certificate", "for", "authentication" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/options.go#L79-L89
134,764
cloudfoundry-incubator/credhub-cli
credhub/generate.go
GeneratePassword
func (ch *CredHub) GeneratePassword(name string, gen generate.Password, overwrite Mode) (credentials.Password, error) { var cred credentials.Password err := ch.generateCredential(name, "password", gen, overwrite, &cred) return cred, err }
go
func (ch *CredHub) GeneratePassword(name string, gen generate.Password, overwrite Mode) (credentials.Password, error) { var cred credentials.Password err := ch.generateCredential(name, "password", gen, overwrite, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GeneratePassword", "(", "name", "string", ",", "gen", "generate", ".", "Password", ",", "overwrite", "Mode", ")", "(", "credentials", ".", "Password", ",", "error", ")", "{", "var", "cred", "credentials", ".", "Pa...
// GeneratePassword generates a password credential based on the provided parameters.
[ "GeneratePassword", "generates", "a", "password", "credential", "based", "on", "the", "provided", "parameters", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/generate.go#L14-L18
134,765
cloudfoundry-incubator/credhub-cli
credhub/generate.go
GenerateUser
func (ch *CredHub) GenerateUser(name string, gen generate.User, overwrite Mode) (credentials.User, error) { var cred credentials.User err := ch.generateCredential(name, "user", gen, overwrite, &cred) return cred, err }
go
func (ch *CredHub) GenerateUser(name string, gen generate.User, overwrite Mode) (credentials.User, error) { var cred credentials.User err := ch.generateCredential(name, "user", gen, overwrite, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GenerateUser", "(", "name", "string", ",", "gen", "generate", ".", "User", ",", "overwrite", "Mode", ")", "(", "credentials", ".", "User", ",", "error", ")", "{", "var", "cred", "credentials", ".", "User", "\n",...
// GenerateUser generates a user credential based on the provided parameters.
[ "GenerateUser", "generates", "a", "user", "credential", "based", "on", "the", "provided", "parameters", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/generate.go#L21-L25
134,766
cloudfoundry-incubator/credhub-cli
credhub/generate.go
GenerateCertificate
func (ch *CredHub) GenerateCertificate(name string, gen generate.Certificate, overwrite Mode) (credentials.Certificate, error) { var cred credentials.Certificate err := ch.generateCredential(name, "certificate", gen, overwrite, &cred) return cred, err }
go
func (ch *CredHub) GenerateCertificate(name string, gen generate.Certificate, overwrite Mode) (credentials.Certificate, error) { var cred credentials.Certificate err := ch.generateCredential(name, "certificate", gen, overwrite, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GenerateCertificate", "(", "name", "string", ",", "gen", "generate", ".", "Certificate", ",", "overwrite", "Mode", ")", "(", "credentials", ".", "Certificate", ",", "error", ")", "{", "var", "cred", "credentials", "...
// GenerateCertificate generates a certificate credential based on the provided parameters.
[ "GenerateCertificate", "generates", "a", "certificate", "credential", "based", "on", "the", "provided", "parameters", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/generate.go#L28-L32
134,767
cloudfoundry-incubator/credhub-cli
credhub/generate.go
GenerateRSA
func (ch *CredHub) GenerateRSA(name string, gen generate.RSA, overwrite Mode) (credentials.RSA, error) { var cred credentials.RSA err := ch.generateCredential(name, "rsa", gen, overwrite, &cred) return cred, err }
go
func (ch *CredHub) GenerateRSA(name string, gen generate.RSA, overwrite Mode) (credentials.RSA, error) { var cred credentials.RSA err := ch.generateCredential(name, "rsa", gen, overwrite, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GenerateRSA", "(", "name", "string", ",", "gen", "generate", ".", "RSA", ",", "overwrite", "Mode", ")", "(", "credentials", ".", "RSA", ",", "error", ")", "{", "var", "cred", "credentials", ".", "RSA", "\n", "...
// GenerateRSA generates an RSA credential based on the provided parameters.
[ "GenerateRSA", "generates", "an", "RSA", "credential", "based", "on", "the", "provided", "parameters", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/generate.go#L35-L39
134,768
cloudfoundry-incubator/credhub-cli
credhub/generate.go
GenerateSSH
func (ch *CredHub) GenerateSSH(name string, gen generate.SSH, overwrite Mode) (credentials.SSH, error) { var cred credentials.SSH err := ch.generateCredential(name, "ssh", gen, overwrite, &cred) return cred, err }
go
func (ch *CredHub) GenerateSSH(name string, gen generate.SSH, overwrite Mode) (credentials.SSH, error) { var cred credentials.SSH err := ch.generateCredential(name, "ssh", gen, overwrite, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GenerateSSH", "(", "name", "string", ",", "gen", "generate", ".", "SSH", ",", "overwrite", "Mode", ")", "(", "credentials", ".", "SSH", ",", "error", ")", "{", "var", "cred", "credentials", ".", "SSH", "\n", "...
// GenerateSSH generates an SSH credential based on the provided parameters.
[ "GenerateSSH", "generates", "an", "SSH", "credential", "based", "on", "the", "provided", "parameters", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/generate.go#L42-L46
134,769
cloudfoundry-incubator/credhub-cli
credhub/generate.go
GenerateCredential
func (ch *CredHub) GenerateCredential(name, credType string, gen interface{}, overwrite Mode) (credentials.Credential, error) { var cred credentials.Credential err := ch.generateCredential(name, credType, gen, overwrite, &cred) return cred, err }
go
func (ch *CredHub) GenerateCredential(name, credType string, gen interface{}, overwrite Mode) (credentials.Credential, error) { var cred credentials.Credential err := ch.generateCredential(name, credType, gen, overwrite, &cred) return cred, err }
[ "func", "(", "ch", "*", "CredHub", ")", "GenerateCredential", "(", "name", ",", "credType", "string", ",", "gen", "interface", "{", "}", ",", "overwrite", "Mode", ")", "(", "credentials", ".", "Credential", ",", "error", ")", "{", "var", "cred", "credent...
// GenerateCredential generates any credential type based on the credType given provided parameters.
[ "GenerateCredential", "generates", "any", "credential", "type", "based", "on", "the", "credType", "given", "provided", "parameters", "." ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/generate.go#L49-L53
134,770
cloudfoundry-incubator/credhub-cli
credhub/interpolate.go
InterpolateString
func (ch *CredHub) InterpolateString(vcapServicesBody string) (string, error) { if !strings.Contains(vcapServicesBody, `"credhub-ref"`) { return vcapServicesBody, nil } requestBody := map[string]interface{}{} if err := json.Unmarshal([]byte(vcapServicesBody), &requestBody); err != nil { return "", err } res...
go
func (ch *CredHub) InterpolateString(vcapServicesBody string) (string, error) { if !strings.Contains(vcapServicesBody, `"credhub-ref"`) { return vcapServicesBody, nil } requestBody := map[string]interface{}{} if err := json.Unmarshal([]byte(vcapServicesBody), &requestBody); err != nil { return "", err } res...
[ "func", "(", "ch", "*", "CredHub", ")", "InterpolateString", "(", "vcapServicesBody", "string", ")", "(", "string", ",", "error", ")", "{", "if", "!", "strings", ".", "Contains", "(", "vcapServicesBody", ",", "`\"credhub-ref\"`", ")", "{", "return", "vcapSer...
//InterpolateString translates credhub refs in a VCAP_SERVICES object into actual credentials
[ "InterpolateString", "translates", "credhub", "refs", "in", "a", "VCAP_SERVICES", "object", "into", "actual", "credentials" ]
379b3fbcf59cce9ff1359f0434d537c63154f37a
https://github.com/cloudfoundry-incubator/credhub-cli/blob/379b3fbcf59cce9ff1359f0434d537c63154f37a/credhub/interpolate.go#L11-L38
134,771
influxdata/platform
http/handler.go
InjectTrace
func InjectTrace(r *http.Request) { if span := opentracing.SpanFromContext(r.Context()); span != nil { span.Tracer().Inject( span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header), ) } }
go
func InjectTrace(r *http.Request) { if span := opentracing.SpanFromContext(r.Context()); span != nil { span.Tracer().Inject( span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header), ) } }
[ "func", "InjectTrace", "(", "r", "*", "http", ".", "Request", ")", "{", "if", "span", ":=", "opentracing", ".", "SpanFromContext", "(", "r", ".", "Context", "(", ")", ")", ";", "span", "!=", "nil", "{", "span", ".", "Tracer", "(", ")", ".", "Inject...
// InjectTrace writes any span from the request's context into the request headers.
[ "InjectTrace", "writes", "any", "span", "from", "the", "request", "s", "context", "into", "the", "request", "headers", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/handler.go#L217-L225
134,772
influxdata/platform
telegraf.go
MarshalJSON
func (tc *TelegrafConfig) MarshalJSON() ([]byte, error) { tce := new(telegrafConfigEncode) *tce = telegrafConfigEncode{ ID: tc.ID, OrganizationID: tc.OrganizationID, Name: tc.Name, Agent: tc.Agent, Plugins: make([]telegrafPluginEncode, len(tc.Plugins)), } for k, p := ...
go
func (tc *TelegrafConfig) MarshalJSON() ([]byte, error) { tce := new(telegrafConfigEncode) *tce = telegrafConfigEncode{ ID: tc.ID, OrganizationID: tc.OrganizationID, Name: tc.Name, Agent: tc.Agent, Plugins: make([]telegrafPluginEncode, len(tc.Plugins)), } for k, p := ...
[ "func", "(", "tc", "*", "TelegrafConfig", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "tce", ":=", "new", "(", "telegrafConfigEncode", ")", "\n", "*", "tce", "=", "telegrafConfigEncode", "{", "ID", ":", "tc", ".", "ID...
// MarshalJSON implement the json.Marshaler interface.
[ "MarshalJSON", "implement", "the", "json", ".", "Marshaler", "interface", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/telegraf.go#L196-L214
134,773
influxdata/platform
telegraf.go
UnmarshalJSON
func (tc *TelegrafConfig) UnmarshalJSON(b []byte) error { tcd := new(telegrafConfigDecode) if err := json.Unmarshal(b, tcd); err != nil { return err } *tc = TelegrafConfig{ ID: tcd.ID, OrganizationID: tcd.OrganizationID, Name: tcd.Name, Agent: tcd.Agent, Plugins: ma...
go
func (tc *TelegrafConfig) UnmarshalJSON(b []byte) error { tcd := new(telegrafConfigDecode) if err := json.Unmarshal(b, tcd); err != nil { return err } *tc = TelegrafConfig{ ID: tcd.ID, OrganizationID: tcd.OrganizationID, Name: tcd.Name, Agent: tcd.Agent, Plugins: ma...
[ "func", "(", "tc", "*", "TelegrafConfig", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "tcd", ":=", "new", "(", "telegrafConfigDecode", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "tcd", ")", ";", ...
// UnmarshalJSON implement the json.Unmarshaler interface.
[ "UnmarshalJSON", "implement", "the", "json", ".", "Unmarshaler", "interface", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/telegraf.go#L299-L312
134,774
influxdata/platform
tsdb/series_file.go
NewSeriesFile
func NewSeriesFile(path string) *SeriesFile { return &SeriesFile{ path: path, metricsEnabled: true, Logger: zap.NewNop(), } }
go
func NewSeriesFile(path string) *SeriesFile { return &SeriesFile{ path: path, metricsEnabled: true, Logger: zap.NewNop(), } }
[ "func", "NewSeriesFile", "(", "path", "string", ")", "*", "SeriesFile", "{", "return", "&", "SeriesFile", "{", "path", ":", "path", ",", "metricsEnabled", ":", "true", ",", "Logger", ":", "zap", ".", "NewNop", "(", ")", ",", "}", "\n", "}" ]
// NewSeriesFile returns a new instance of SeriesFile.
[ "NewSeriesFile", "returns", "a", "new", "instance", "of", "SeriesFile", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/series_file.go#L55-L61
134,775
influxdata/platform
tsdb/series_file.go
Retain
func (f *SeriesFile) Retain() func() { if f != nil { f.refs.RLock() // Return the RUnlock func as the release func to be called when done. return f.refs.RUnlock } return nop }
go
func (f *SeriesFile) Retain() func() { if f != nil { f.refs.RLock() // Return the RUnlock func as the release func to be called when done. return f.refs.RUnlock } return nop }
[ "func", "(", "f", "*", "SeriesFile", ")", "Retain", "(", ")", "func", "(", ")", "{", "if", "f", "!=", "nil", "{", "f", ".", "refs", ".", "RLock", "(", ")", "\n\n", "// Return the RUnlock func as the release func to be called when done.", "return", "f", ".", ...
// Retain adds a reference count to the file. It returns a release func.
[ "Retain", "adds", "a", "reference", "count", "to", "the", "file", ".", "It", "returns", "a", "release", "func", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/series_file.go#L174-L182
134,776
influxdata/platform
chronograf/influx/databases.go
DropDB
func (c *Client) DropDB(ctx context.Context, db string) error { _, err := c.Query(ctx, chronograf.Query{ Command: fmt.Sprintf(`DROP DATABASE "%s"`, db), DB: db, }) if err != nil { return err } return nil }
go
func (c *Client) DropDB(ctx context.Context, db string) error { _, err := c.Query(ctx, chronograf.Query{ Command: fmt.Sprintf(`DROP DATABASE "%s"`, db), DB: db, }) if err != nil { return err } return nil }
[ "func", "(", "c", "*", "Client", ")", "DropDB", "(", "ctx", "context", ".", "Context", ",", "db", "string", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "Query", "(", "ctx", ",", "chronograf", ".", "Query", "{", "Command", ":", "fmt", ".",...
// DropDB drops a database within Influx
[ "DropDB", "drops", "a", "database", "within", "Influx" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/chronograf/influx/databases.go#L32-L41
134,777
influxdata/platform
chronograf/influx/databases.go
CreateRP
func (c *Client) CreateRP(ctx context.Context, db string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) { query := fmt.Sprintf(`CREATE RETENTION POLICY "%s" ON "%s" DURATION %s REPLICATION %d`, rp.Name, db, rp.Duration, rp.Replication) if len(rp.ShardDuration) != 0 { query = fmt.Sprintf(`%s S...
go
func (c *Client) CreateRP(ctx context.Context, db string, rp *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) { query := fmt.Sprintf(`CREATE RETENTION POLICY "%s" ON "%s" DURATION %s REPLICATION %d`, rp.Name, db, rp.Duration, rp.Replication) if len(rp.ShardDuration) != 0 { query = fmt.Sprintf(`%s S...
[ "func", "(", "c", "*", "Client", ")", "CreateRP", "(", "ctx", "context", ".", "Context", ",", "db", "string", ",", "rp", "*", "chronograf", ".", "RetentionPolicy", ")", "(", "*", "chronograf", ".", "RetentionPolicy", ",", "error", ")", "{", "query", ":...
// CreateRP creates a retention policy for a specific database
[ "CreateRP", "creates", "a", "retention", "policy", "for", "a", "specific", "database" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/chronograf/influx/databases.go#L63-L87
134,778
influxdata/platform
chronograf/influx/databases.go
UpdateRP
func (c *Client) UpdateRP(ctx context.Context, db string, rp string, upd *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) { var buffer bytes.Buffer buffer.WriteString(fmt.Sprintf(`ALTER RETENTION POLICY "%s" ON "%s"`, rp, db)) if len(upd.Duration) > 0 { buffer.WriteString(" DURATION " + upd.Durati...
go
func (c *Client) UpdateRP(ctx context.Context, db string, rp string, upd *chronograf.RetentionPolicy) (*chronograf.RetentionPolicy, error) { var buffer bytes.Buffer buffer.WriteString(fmt.Sprintf(`ALTER RETENTION POLICY "%s" ON "%s"`, rp, db)) if len(upd.Duration) > 0 { buffer.WriteString(" DURATION " + upd.Durati...
[ "func", "(", "c", "*", "Client", ")", "UpdateRP", "(", "ctx", "context", ".", "Context", ",", "db", "string", ",", "rp", "string", ",", "upd", "*", "chronograf", ".", "RetentionPolicy", ")", "(", "*", "chronograf", ".", "RetentionPolicy", ",", "error", ...
// UpdateRP updates a specific retention policy for a specific database
[ "UpdateRP", "updates", "a", "specific", "retention", "policy", "for", "a", "specific", "database" ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/chronograf/influx/databases.go#L90-L139
134,779
influxdata/platform
tsdb/tsm1/file_store.go
enableTraceLogging
func (f *FileStore) enableTraceLogging(enabled bool) { f.traceLogging = enabled if enabled { f.traceLogger = f.logger } }
go
func (f *FileStore) enableTraceLogging(enabled bool) { f.traceLogging = enabled if enabled { f.traceLogger = f.logger } }
[ "func", "(", "f", "*", "FileStore", ")", "enableTraceLogging", "(", "enabled", "bool", ")", "{", "f", ".", "traceLogging", "=", "enabled", "\n", "if", "enabled", "{", "f", ".", "traceLogger", "=", "f", ".", "logger", "\n", "}", "\n", "}" ]
// enableTraceLogging must be called before the FileStore is opened.
[ "enableTraceLogging", "must", "be", "called", "before", "the", "FileStore", "is", "opened", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/file_store.go#L274-L279
134,780
influxdata/platform
tsdb/tsm1/file_store.go
Free
func (f *FileStore) Free() error { f.mu.RLock() defer f.mu.RUnlock() for _, f := range f.files { if err := f.Free(); err != nil { return err } } return nil }
go
func (f *FileStore) Free() error { f.mu.RLock() defer f.mu.RUnlock() for _, f := range f.files { if err := f.Free(); err != nil { return err } } return nil }
[ "func", "(", "f", "*", "FileStore", ")", "Free", "(", ")", "error", "{", "f", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "f", ".", "mu", ".", "RUnlock", "(", ")", "\n", "for", "_", ",", "f", ":=", "range", "f", ".", "files", "{", "if...
// Free releases any resources held by the FileStore. The resources will be re-acquired // if necessary if they are needed after freeing them.
[ "Free", "releases", "any", "resources", "held", "by", "the", "FileStore", ".", "The", "resources", "will", "be", "re", "-", "acquired", "if", "necessary", "if", "they", "are", "needed", "after", "freeing", "them", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/file_store.go#L364-L373
134,781
influxdata/platform
tsdb/explode.go
ExplodePoints
func ExplodePoints(org, bucket platform.ID, points []models.Point) ([]models.Point, error) { out := make([]models.Point, 0, len(points)) // TODO(jeff): We should add a RawEncode() method or something to the platform.ID type // or we should use hex encoded measurement names. Either way, we shouldn't be doing a // d...
go
func ExplodePoints(org, bucket platform.ID, points []models.Point) ([]models.Point, error) { out := make([]models.Point, 0, len(points)) // TODO(jeff): We should add a RawEncode() method or something to the platform.ID type // or we should use hex encoded measurement names. Either way, we shouldn't be doing a // d...
[ "func", "ExplodePoints", "(", "org", ",", "bucket", "platform", ".", "ID", ",", "points", "[", "]", "models", ".", "Point", ")", "(", "[", "]", "models", ".", "Point", ",", "error", ")", "{", "out", ":=", "make", "(", "[", "]", "models", ".", "Po...
// ExplodePoints creates a list of points that only contains one field per point. It also // moves the measurement to a tag, and changes the measurement to be the provided argument.
[ "ExplodePoints", "creates", "a", "list", "of", "points", "that", "only", "contains", "one", "field", "per", "point", ".", "It", "also", "moves", "the", "measurement", "to", "a", "tag", "and", "changes", "the", "measurement", "to", "be", "the", "provided", ...
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/explode.go#L38-L89
134,782
influxdata/platform
authz.go
Valid
func (r Resource) Valid() (err error) { switch r { case AuthorizationsResource: // 0 case BucketsResource: // 1 case DashboardsResource: // 2 case OrgsResource: // 3 case TasksResource: // 4 case TelegrafsResource: // 5 case SourcesResource: // 6 case UsersResource: //7 default: err = ErrInvalidResource } ...
go
func (r Resource) Valid() (err error) { switch r { case AuthorizationsResource: // 0 case BucketsResource: // 1 case DashboardsResource: // 2 case OrgsResource: // 3 case TasksResource: // 4 case TelegrafsResource: // 5 case SourcesResource: // 6 case UsersResource: //7 default: err = ErrInvalidResource } ...
[ "func", "(", "r", "Resource", ")", "Valid", "(", ")", "(", "err", "error", ")", "{", "switch", "r", "{", "case", "AuthorizationsResource", ":", "// 0", "case", "BucketsResource", ":", "// 1", "case", "DashboardsResource", ":", "// 2", "case", "OrgsResource",...
// Valid checks if the resource is a member of the Resource enum.
[ "Valid", "checks", "if", "the", "resource", "is", "a", "member", "of", "the", "Resource", "enum", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/authz.go#L129-L144
134,783
influxdata/platform
authz.go
NewPermissionAtID
func NewPermissionAtID(id ID, a Action, r Resource) (*Permission, error) { p := &Permission{ Action: a, Resource: r, ID: &id, } return p, p.Valid() }
go
func NewPermissionAtID(id ID, a Action, r Resource) (*Permission, error) { p := &Permission{ Action: a, Resource: r, ID: &id, } return p, p.Valid() }
[ "func", "NewPermissionAtID", "(", "id", "ID", ",", "a", "Action", ",", "r", "Resource", ")", "(", "*", "Permission", ",", "error", ")", "{", "p", ":=", "&", "Permission", "{", "Action", ":", "a", ",", "Resource", ":", "r", ",", "ID", ":", "&", "i...
// NewPermissionAtID creates a permission with the provided arguments.
[ "NewPermissionAtID", "creates", "a", "permission", "with", "the", "provided", "arguments", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/authz.go#L202-L210
134,784
influxdata/platform
authz.go
OrgAdminPermissions
func OrgAdminPermissions(orgID ID) []Permission { ps := []Permission{} for _, r := range OrgResources { for _, a := range actions { ps = append(ps, Permission{ID: &orgID, Action: a, Resource: r}) } } return ps }
go
func OrgAdminPermissions(orgID ID) []Permission { ps := []Permission{} for _, r := range OrgResources { for _, a := range actions { ps = append(ps, Permission{ID: &orgID, Action: a, Resource: r}) } } return ps }
[ "func", "OrgAdminPermissions", "(", "orgID", "ID", ")", "[", "]", "Permission", "{", "ps", ":=", "[", "]", "Permission", "{", "}", "\n", "for", "_", ",", "r", ":=", "range", "OrgResources", "{", "for", "_", ",", "a", ":=", "range", "actions", "{", ...
// OrgAdminPermissions are the default permissions for org admins.
[ "OrgAdminPermissions", "are", "the", "default", "permissions", "for", "org", "admins", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/authz.go#L225-L234
134,785
influxdata/platform
authz.go
OrgMemberPermissions
func OrgMemberPermissions(orgID ID) []Permission { ps := []Permission{} for _, r := range OrgResources { ps = append(ps, Permission{ID: &orgID, Action: ReadAction, Resource: r}) } return ps }
go
func OrgMemberPermissions(orgID ID) []Permission { ps := []Permission{} for _, r := range OrgResources { ps = append(ps, Permission{ID: &orgID, Action: ReadAction, Resource: r}) } return ps }
[ "func", "OrgMemberPermissions", "(", "orgID", "ID", ")", "[", "]", "Permission", "{", "ps", ":=", "[", "]", "Permission", "{", "}", "\n", "for", "_", ",", "r", ":=", "range", "OrgResources", "{", "ps", "=", "append", "(", "ps", ",", "Permission", "{"...
// OrgMemberPermissions are the default permissions for org members.
[ "OrgMemberPermissions", "are", "the", "default", "permissions", "for", "org", "members", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/authz.go#L237-L244
134,786
influxdata/platform
http/paging.go
decodeFindOptions
func decodeFindOptions(ctx context.Context, r *http.Request) (*platform.FindOptions, error) { opts := &platform.FindOptions{} qp := r.URL.Query() if offset := qp.Get("offset"); offset != "" { o, err := strconv.Atoi(offset) if err != nil { return nil, err } opts.Offset = o } if limit := qp.Get("limit"...
go
func decodeFindOptions(ctx context.Context, r *http.Request) (*platform.FindOptions, error) { opts := &platform.FindOptions{} qp := r.URL.Query() if offset := qp.Get("offset"); offset != "" { o, err := strconv.Atoi(offset) if err != nil { return nil, err } opts.Offset = o } if limit := qp.Get("limit"...
[ "func", "decodeFindOptions", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ")", "(", "*", "platform", ".", "FindOptions", ",", "error", ")", "{", "opts", ":=", "&", "platform", ".", "FindOptions", "{", "}", "\n", "qp", ...
// decodeFindOptions returns a FindOptions decoded from http request.
[ "decodeFindOptions", "returns", "a", "FindOptions", "decoded", "from", "http", "request", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/paging.go#L15-L57
134,787
influxdata/platform
http/task_service.go
CreateTask
func (t TaskService) CreateTask(ctx context.Context, tsk *platform.Task) error { u, err := newURL(t.Addr, tasksPath) if err != nil { return err } taskBytes, err := json.Marshal(tsk) if err != nil { return err } req, err := http.NewRequest("POST", u.String(), bytes.NewReader(taskBytes)) if err != nil { r...
go
func (t TaskService) CreateTask(ctx context.Context, tsk *platform.Task) error { u, err := newURL(t.Addr, tasksPath) if err != nil { return err } taskBytes, err := json.Marshal(tsk) if err != nil { return err } req, err := http.NewRequest("POST", u.String(), bytes.NewReader(taskBytes)) if err != nil { r...
[ "func", "(", "t", "TaskService", ")", "CreateTask", "(", "ctx", "context", ".", "Context", ",", "tsk", "*", "platform", ".", "Task", ")", "error", "{", "u", ",", "err", ":=", "newURL", "(", "t", ".", "Addr", ",", "tasksPath", ")", "\n", "if", "err"...
// CreateTask creates a new task.
[ "CreateTask", "creates", "a", "new", "task", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/task_service.go#L948-L986
134,788
influxdata/platform
tsdb/tsm1/encoding.go
NewIntegerValue
func NewIntegerValue(t int64, v int64) Value { return IntegerValue{unixnano: t, value: v} }
go
func NewIntegerValue(t int64, v int64) Value { return IntegerValue{unixnano: t, value: v} }
[ "func", "NewIntegerValue", "(", "t", "int64", ",", "v", "int64", ")", "Value", "{", "return", "IntegerValue", "{", "unixnano", ":", "t", ",", "value", ":", "v", "}", "\n", "}" ]
// NewIntegerValue returns a new integer value.
[ "NewIntegerValue", "returns", "a", "new", "integer", "value", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/encoding.go#L133-L135
134,789
influxdata/platform
tsdb/tsm1/encoding.go
NewUnsignedValue
func NewUnsignedValue(t int64, v uint64) Value { return UnsignedValue{unixnano: t, value: v} }
go
func NewUnsignedValue(t int64, v uint64) Value { return UnsignedValue{unixnano: t, value: v} }
[ "func", "NewUnsignedValue", "(", "t", "int64", ",", "v", "uint64", ")", "Value", "{", "return", "UnsignedValue", "{", "unixnano", ":", "t", ",", "value", ":", "v", "}", "\n", "}" ]
// NewUnsignedValue returns a new unsigned integer value.
[ "NewUnsignedValue", "returns", "a", "new", "unsigned", "integer", "value", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/encoding.go#L138-L140
134,790
influxdata/platform
tsdb/tsm1/encoding.go
NewFloatValue
func NewFloatValue(t int64, v float64) Value { return FloatValue{unixnano: t, value: v} }
go
func NewFloatValue(t int64, v float64) Value { return FloatValue{unixnano: t, value: v} }
[ "func", "NewFloatValue", "(", "t", "int64", ",", "v", "float64", ")", "Value", "{", "return", "FloatValue", "{", "unixnano", ":", "t", ",", "value", ":", "v", "}", "\n", "}" ]
// NewFloatValue returns a new float value.
[ "NewFloatValue", "returns", "a", "new", "float", "value", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/encoding.go#L143-L145
134,791
influxdata/platform
tsdb/tsm1/encoding.go
NewBooleanValue
func NewBooleanValue(t int64, v bool) Value { return BooleanValue{unixnano: t, value: v} }
go
func NewBooleanValue(t int64, v bool) Value { return BooleanValue{unixnano: t, value: v} }
[ "func", "NewBooleanValue", "(", "t", "int64", ",", "v", "bool", ")", "Value", "{", "return", "BooleanValue", "{", "unixnano", ":", "t", ",", "value", ":", "v", "}", "\n", "}" ]
// NewBooleanValue returns a new boolean value.
[ "NewBooleanValue", "returns", "a", "new", "boolean", "value", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/encoding.go#L148-L150
134,792
influxdata/platform
tsdb/tsm1/encoding.go
NewStringValue
func NewStringValue(t int64, v string) Value { return StringValue{unixnano: t, value: v} }
go
func NewStringValue(t int64, v string) Value { return StringValue{unixnano: t, value: v} }
[ "func", "NewStringValue", "(", "t", "int64", ",", "v", "string", ")", "Value", "{", "return", "StringValue", "{", "unixnano", ":", "t", ",", "value", ":", "v", "}", "\n", "}" ]
// NewStringValue returns a new string value.
[ "NewStringValue", "returns", "a", "new", "string", "value", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/encoding.go#L153-L155
134,793
influxdata/platform
tsdb/tsm1/encoding.go
DecodeIntegerBlock
func DecodeIntegerBlock(block []byte, a *[]IntegerValue) ([]IntegerValue, error) { blockType := block[0] if blockType != BlockInteger { return nil, fmt.Errorf("invalid block type: exp %d, got %d", BlockInteger, blockType) } block = block[1:] // The first 8 bytes is the minimum timestamp of the block tb, vb, e...
go
func DecodeIntegerBlock(block []byte, a *[]IntegerValue) ([]IntegerValue, error) { blockType := block[0] if blockType != BlockInteger { return nil, fmt.Errorf("invalid block type: exp %d, got %d", BlockInteger, blockType) } block = block[1:] // The first 8 bytes is the minimum timestamp of the block tb, vb, e...
[ "func", "DecodeIntegerBlock", "(", "block", "[", "]", "byte", ",", "a", "*", "[", "]", "IntegerValue", ")", "(", "[", "]", "IntegerValue", ",", "error", ")", "{", "blockType", ":=", "block", "[", "0", "]", "\n", "if", "blockType", "!=", "BlockInteger",...
// DecodeIntegerBlock decodes the integer block from the byte slice // and appends the integer values to a.
[ "DecodeIntegerBlock", "decodes", "the", "integer", "block", "from", "the", "byte", "slice", "and", "appends", "the", "integer", "values", "to", "a", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/encoding.go#L648-L700
134,794
influxdata/platform
tsdb/tsm1/encoding.go
DecodeStringBlock
func DecodeStringBlock(block []byte, a *[]StringValue) ([]StringValue, error) { blockType := block[0] if blockType != BlockString { return nil, fmt.Errorf("invalid block type: exp %d, got %d", BlockString, blockType) } block = block[1:] // The first 8 bytes is the minimum timestamp of the block tb, vb, err :=...
go
func DecodeStringBlock(block []byte, a *[]StringValue) ([]StringValue, error) { blockType := block[0] if blockType != BlockString { return nil, fmt.Errorf("invalid block type: exp %d, got %d", BlockString, blockType) } block = block[1:] // The first 8 bytes is the minimum timestamp of the block tb, vb, err :=...
[ "func", "DecodeStringBlock", "(", "block", "[", "]", "byte", ",", "a", "*", "[", "]", "StringValue", ")", "(", "[", "]", "StringValue", ",", "error", ")", "{", "blockType", ":=", "block", "[", "0", "]", "\n", "if", "blockType", "!=", "BlockString", "...
// DecodeStringBlock decodes the string block from the byte slice // and appends the string values to a.
[ "DecodeStringBlock", "decodes", "the", "string", "block", "from", "the", "byte", "slice", "and", "appends", "the", "string", "values", "to", "a", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/tsdb/tsm1/encoding.go#L886-L941
134,795
influxdata/platform
bolt/organization.go
CreateOrganization
func (c *Client) CreateOrganization(ctx context.Context, o *platform.Organization) error { op := getOp(platform.OpCreateOrganization) return c.db.Update(func(tx *bolt.Tx) error { unique := c.uniqueOrganizationName(ctx, tx, o) if !unique { return &platform.Error{ Code: platform.EConflict, Op: op, ...
go
func (c *Client) CreateOrganization(ctx context.Context, o *platform.Organization) error { op := getOp(platform.OpCreateOrganization) return c.db.Update(func(tx *bolt.Tx) error { unique := c.uniqueOrganizationName(ctx, tx, o) if !unique { return &platform.Error{ Code: platform.EConflict, Op: op, ...
[ "func", "(", "c", "*", "Client", ")", "CreateOrganization", "(", "ctx", "context", ".", "Context", ",", "o", "*", "platform", ".", "Organization", ")", "error", "{", "op", ":=", "getOp", "(", "platform", ".", "OpCreateOrganization", ")", "\n", "return", ...
// CreateOrganization creates a platform organization and sets b.ID.
[ "CreateOrganization", "creates", "a", "platform", "organization", "and", "sets", "b", ".", "ID", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bolt/organization.go#L241-L269
134,796
influxdata/platform
bucket.go
QueryParams
func (f BucketFilter) QueryParams() map[string][]string { qp := map[string][]string{} if f.ID != nil { qp["id"] = []string{f.ID.String()} } if f.Name != nil { qp["name"] = []string{*f.Name} } if f.OrganizationID != nil { qp["orgID"] = []string{f.OrganizationID.String()} } if f.Organization != nil { q...
go
func (f BucketFilter) QueryParams() map[string][]string { qp := map[string][]string{} if f.ID != nil { qp["id"] = []string{f.ID.String()} } if f.Name != nil { qp["name"] = []string{*f.Name} } if f.OrganizationID != nil { qp["orgID"] = []string{f.OrganizationID.String()} } if f.Organization != nil { q...
[ "func", "(", "f", "BucketFilter", ")", "QueryParams", "(", ")", "map", "[", "string", "]", "[", "]", "string", "{", "qp", ":=", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n", "if", "f", ".", "ID", "!=", "nil", "{", "qp", "[", ...
// QueryParams Converts BucketFilter fields to url query params.
[ "QueryParams", "Converts", "BucketFilter", "fields", "to", "url", "query", "params", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/bucket.go#L79-L98
134,797
influxdata/platform
http/query_service.go
NewQueryHandler
func NewQueryHandler() *QueryHandler { h := &QueryHandler{ Router: NewRouter(), csvDialect: csv.Dialect{ ResultEncoderConfig: csv.DefaultEncoderConfig(), }, } h.HandlerFunc("GET", "/ping", h.handlePing) h.HandlerFunc("POST", queryPath, h.handlePostQuery) return h }
go
func NewQueryHandler() *QueryHandler { h := &QueryHandler{ Router: NewRouter(), csvDialect: csv.Dialect{ ResultEncoderConfig: csv.DefaultEncoderConfig(), }, } h.HandlerFunc("GET", "/ping", h.handlePing) h.HandlerFunc("POST", queryPath, h.handlePostQuery) return h }
[ "func", "NewQueryHandler", "(", ")", "*", "QueryHandler", "{", "h", ":=", "&", "QueryHandler", "{", "Router", ":", "NewRouter", "(", ")", ",", "csvDialect", ":", "csv", ".", "Dialect", "{", "ResultEncoderConfig", ":", "csv", ".", "DefaultEncoderConfig", "(",...
// NewQueryHandler returns a new instance of QueryHandler.
[ "NewQueryHandler", "returns", "a", "new", "instance", "of", "QueryHandler", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query_service.go#L35-L46
134,798
influxdata/platform
http/query_service.go
Query
func (s *QueryService) Query(ctx context.Context, req *query.Request) (flux.ResultIterator, error) { u, err := newURL(s.Addr, queryPath) if err != nil { return nil, err } var body bytes.Buffer if err := json.NewEncoder(&body).Encode(req); err != nil { return nil, err } hreq, err := http.NewRequest("POST", u...
go
func (s *QueryService) Query(ctx context.Context, req *query.Request) (flux.ResultIterator, error) { u, err := newURL(s.Addr, queryPath) if err != nil { return nil, err } var body bytes.Buffer if err := json.NewEncoder(&body).Encode(req); err != nil { return nil, err } hreq, err := http.NewRequest("POST", u...
[ "func", "(", "s", "*", "QueryService", ")", "Query", "(", "ctx", "context", ".", "Context", ",", "req", "*", "query", ".", "Request", ")", "(", "flux", ".", "ResultIterator", ",", "error", ")", "{", "u", ",", "err", ":=", "newURL", "(", "s", ".", ...
// Query calls the query route with the requested query and returns a result iterator.
[ "Query", "calls", "the", "query", "route", "with", "the", "requested", "query", "and", "returns", "a", "result", "iterator", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query_service.go#L152-L195
134,799
influxdata/platform
http/query_service.go
readStats
func (s *statsResultIterator) readStats() { data := s.resp.Trailer.Get(queryStatisticsTrailer) if data != "" { s.err = json.Unmarshal([]byte(data), &s.statisitcs) } }
go
func (s *statsResultIterator) readStats() { data := s.resp.Trailer.Get(queryStatisticsTrailer) if data != "" { s.err = json.Unmarshal([]byte(data), &s.statisitcs) } }
[ "func", "(", "s", "*", "statsResultIterator", ")", "readStats", "(", ")", "{", "data", ":=", "s", ".", "resp", ".", "Trailer", ".", "Get", "(", "queryStatisticsTrailer", ")", "\n", "if", "data", "!=", "\"", "\"", "{", "s", ".", "err", "=", "json", ...
// readStats reads the query statisitcs off the response trailers.
[ "readStats", "reads", "the", "query", "statisitcs", "off", "the", "response", "trailers", "." ]
d500d3cf55899337bc03259b46c58bae9c06f1eb
https://github.com/influxdata/platform/blob/d500d3cf55899337bc03259b46c58bae9c06f1eb/http/query_service.go#L231-L236