id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,800 | adjust/rmq | redis_wrapper.go | checkErr | func checkErr(err error) (ok bool) {
switch err {
case nil:
return true
case redis.Nil:
return false
default:
log.Panicf("rmq redis error is not nil %s", err)
return false
}
} | go | func checkErr(err error) (ok bool) {
switch err {
case nil:
return true
case redis.Nil:
return false
default:
log.Panicf("rmq redis error is not nil %s", err)
return false
}
} | [
"func",
"checkErr",
"(",
"err",
"error",
")",
"(",
"ok",
"bool",
")",
"{",
"switch",
"err",
"{",
"case",
"nil",
":",
"return",
"true",
"\n",
"case",
"redis",
".",
"Nil",
":",
"return",
"false",
"\n",
"default",
":",
"log",
".",
"Panicf",
"(",
"\"",... | // checkErr returns true if there is no error, false if the result error is nil and panics if there's another error | [
"checkErr",
"returns",
"true",
"if",
"there",
"is",
"no",
"error",
"false",
"if",
"the",
"result",
"error",
"is",
"nil",
"and",
"panics",
"if",
"there",
"s",
"another",
"error"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/redis_wrapper.go#L89-L99 |
22,801 | adjust/rmq | queue.go | Publish | func (queue *redisQueue) Publish(payload string) bool {
// debug(fmt.Sprintf("publish %s %s", payload, queue)) // COMMENTOUT
return queue.redisClient.LPush(queue.readyKey, payload)
} | go | func (queue *redisQueue) Publish(payload string) bool {
// debug(fmt.Sprintf("publish %s %s", payload, queue)) // COMMENTOUT
return queue.redisClient.LPush(queue.readyKey, payload)
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"Publish",
"(",
"payload",
"string",
")",
"bool",
"{",
"// debug(fmt.Sprintf(\"publish %s %s\", payload, queue)) // COMMENTOUT",
"return",
"queue",
".",
"redisClient",
".",
"LPush",
"(",
"queue",
".",
"readyKey",
",",
"p... | // Publish adds a delivery with the given payload to the queue | [
"Publish",
"adds",
"a",
"delivery",
"with",
"the",
"given",
"payload",
"to",
"the",
"queue"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L96-L99 |
22,802 | adjust/rmq | queue.go | PublishBytes | func (queue *redisQueue) PublishBytes(payload []byte) bool {
return queue.Publish(string(payload))
} | go | func (queue *redisQueue) PublishBytes(payload []byte) bool {
return queue.Publish(string(payload))
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"PublishBytes",
"(",
"payload",
"[",
"]",
"byte",
")",
"bool",
"{",
"return",
"queue",
".",
"Publish",
"(",
"string",
"(",
"payload",
")",
")",
"\n",
"}"
] | // PublishBytes just casts the bytes and calls Publish | [
"PublishBytes",
"just",
"casts",
"the",
"bytes",
"and",
"calls",
"Publish"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L102-L104 |
22,803 | adjust/rmq | queue.go | Close | func (queue *redisQueue) Close() bool {
queue.PurgeRejected()
queue.PurgeReady()
count, _ := queue.redisClient.SRem(queuesKey, queue.name)
return count > 0
} | go | func (queue *redisQueue) Close() bool {
queue.PurgeRejected()
queue.PurgeReady()
count, _ := queue.redisClient.SRem(queuesKey, queue.name)
return count > 0
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"Close",
"(",
")",
"bool",
"{",
"queue",
".",
"PurgeRejected",
"(",
")",
"\n",
"queue",
".",
"PurgeReady",
"(",
")",
"\n",
"count",
",",
"_",
":=",
"queue",
".",
"redisClient",
".",
"SRem",
"(",
"queuesKe... | // Close purges and removes the queue from the list of queues | [
"Close",
"purges",
"and",
"removes",
"the",
"queue",
"from",
"the",
"list",
"of",
"queues"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L117-L122 |
22,804 | adjust/rmq | queue.go | ReturnAllUnacked | func (queue *redisQueue) ReturnAllUnacked() int {
count, ok := queue.redisClient.LLen(queue.unackedKey)
if !ok {
return 0
}
unackedCount := count
for i := 0; i < unackedCount; i++ {
if _, ok := queue.redisClient.RPopLPush(queue.unackedKey, queue.readyKey); !ok {
return i
}
// debug(fmt.Sprintf("rmq que... | go | func (queue *redisQueue) ReturnAllUnacked() int {
count, ok := queue.redisClient.LLen(queue.unackedKey)
if !ok {
return 0
}
unackedCount := count
for i := 0; i < unackedCount; i++ {
if _, ok := queue.redisClient.RPopLPush(queue.unackedKey, queue.readyKey); !ok {
return i
}
// debug(fmt.Sprintf("rmq que... | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"ReturnAllUnacked",
"(",
")",
"int",
"{",
"count",
",",
"ok",
":=",
"queue",
".",
"redisClient",
".",
"LLen",
"(",
"queue",
".",
"unackedKey",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
"\n",
"}",
... | // ReturnAllUnacked moves all unacked deliveries back to the ready
// queue and deletes the unacked key afterwards, returns number of returned
// deliveries | [
"ReturnAllUnacked",
"moves",
"all",
"unacked",
"deliveries",
"back",
"to",
"the",
"ready",
"queue",
"and",
"deletes",
"the",
"unacked",
"key",
"afterwards",
"returns",
"number",
"of",
"returned",
"deliveries"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L142-L157 |
22,805 | adjust/rmq | queue.go | ReturnAllRejected | func (queue *redisQueue) ReturnAllRejected() int {
rejectedCount, _ := queue.redisClient.LLen(queue.rejectedKey)
return queue.ReturnRejected(rejectedCount)
} | go | func (queue *redisQueue) ReturnAllRejected() int {
rejectedCount, _ := queue.redisClient.LLen(queue.rejectedKey)
return queue.ReturnRejected(rejectedCount)
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"ReturnAllRejected",
"(",
")",
"int",
"{",
"rejectedCount",
",",
"_",
":=",
"queue",
".",
"redisClient",
".",
"LLen",
"(",
"queue",
".",
"rejectedKey",
")",
"\n",
"return",
"queue",
".",
"ReturnRejected",
"(",
... | // ReturnAllRejected moves all rejected deliveries back to the ready
// list and returns the number of returned deliveries | [
"ReturnAllRejected",
"moves",
"all",
"rejected",
"deliveries",
"back",
"to",
"the",
"ready",
"list",
"and",
"returns",
"the",
"number",
"of",
"returned",
"deliveries"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L161-L164 |
22,806 | adjust/rmq | queue.go | ReturnRejected | func (queue *redisQueue) ReturnRejected(count int) int {
if count == 0 {
return 0
}
for i := 0; i < count; i++ {
_, ok := queue.redisClient.RPopLPush(queue.rejectedKey, queue.readyKey)
if !ok {
return i
}
// debug(fmt.Sprintf("rmq queue returned rejected delivery %s %s", value, queue.readyKey)) // COMM... | go | func (queue *redisQueue) ReturnRejected(count int) int {
if count == 0 {
return 0
}
for i := 0; i < count; i++ {
_, ok := queue.redisClient.RPopLPush(queue.rejectedKey, queue.readyKey)
if !ok {
return i
}
// debug(fmt.Sprintf("rmq queue returned rejected delivery %s %s", value, queue.readyKey)) // COMM... | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"ReturnRejected",
"(",
"count",
"int",
")",
"int",
"{",
"if",
"count",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
"{",
"_",
",",... | // ReturnRejected tries to return count rejected deliveries back to
// the ready list and returns the number of returned deliveries | [
"ReturnRejected",
"tries",
"to",
"return",
"count",
"rejected",
"deliveries",
"back",
"to",
"the",
"ready",
"list",
"and",
"returns",
"the",
"number",
"of",
"returned",
"deliveries"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L168-L182 |
22,807 | adjust/rmq | queue.go | CloseInConnection | func (queue *redisQueue) CloseInConnection() {
queue.redisClient.Del(queue.unackedKey)
queue.redisClient.Del(queue.consumersKey)
queue.redisClient.SRem(queue.queuesKey, queue.name)
} | go | func (queue *redisQueue) CloseInConnection() {
queue.redisClient.Del(queue.unackedKey)
queue.redisClient.Del(queue.consumersKey)
queue.redisClient.SRem(queue.queuesKey, queue.name)
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"CloseInConnection",
"(",
")",
"{",
"queue",
".",
"redisClient",
".",
"Del",
"(",
"queue",
".",
"unackedKey",
")",
"\n",
"queue",
".",
"redisClient",
".",
"Del",
"(",
"queue",
".",
"consumersKey",
")",
"\n",
... | // CloseInConnection closes the queue in the associated connection by removing all related keys | [
"CloseInConnection",
"closes",
"the",
"queue",
"in",
"the",
"associated",
"connection",
"by",
"removing",
"all",
"related",
"keys"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L185-L189 |
22,808 | adjust/rmq | queue.go | StartConsuming | func (queue *redisQueue) StartConsuming(prefetchLimit int, pollDuration time.Duration) bool {
if queue.deliveryChan != nil {
return false // already consuming
}
// add queue to list of queues consumed on this connection
if ok := queue.redisClient.SAdd(queue.queuesKey, queue.name); !ok {
log.Panicf("rmq queue f... | go | func (queue *redisQueue) StartConsuming(prefetchLimit int, pollDuration time.Duration) bool {
if queue.deliveryChan != nil {
return false // already consuming
}
// add queue to list of queues consumed on this connection
if ok := queue.redisClient.SAdd(queue.queuesKey, queue.name); !ok {
log.Panicf("rmq queue f... | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"StartConsuming",
"(",
"prefetchLimit",
"int",
",",
"pollDuration",
"time",
".",
"Duration",
")",
"bool",
"{",
"if",
"queue",
".",
"deliveryChan",
"!=",
"nil",
"{",
"return",
"false",
"// already consuming",
"\n",
... | // StartConsuming starts consuming into a channel of size prefetchLimit
// must be called before consumers can be added!
// pollDuration is the duration the queue sleeps before checking for new deliveries | [
"StartConsuming",
"starts",
"consuming",
"into",
"a",
"channel",
"of",
"size",
"prefetchLimit",
"must",
"be",
"called",
"before",
"consumers",
"can",
"be",
"added!",
"pollDuration",
"is",
"the",
"duration",
"the",
"queue",
"sleeps",
"before",
"checking",
"for",
... | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L203-L220 |
22,809 | adjust/rmq | queue.go | AddConsumer | func (queue *redisQueue) AddConsumer(tag string, consumer Consumer) string {
queue.stopWg.Add(1)
name := queue.addConsumer(tag)
go queue.consumerConsume(consumer)
return name
} | go | func (queue *redisQueue) AddConsumer(tag string, consumer Consumer) string {
queue.stopWg.Add(1)
name := queue.addConsumer(tag)
go queue.consumerConsume(consumer)
return name
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"AddConsumer",
"(",
"tag",
"string",
",",
"consumer",
"Consumer",
")",
"string",
"{",
"queue",
".",
"stopWg",
".",
"Add",
"(",
"1",
")",
"\n",
"name",
":=",
"queue",
".",
"addConsumer",
"(",
"tag",
")",
"... | // AddConsumer adds a consumer to the queue and returns its internal name
// panics if StartConsuming wasn't called before! | [
"AddConsumer",
"adds",
"a",
"consumer",
"to",
"the",
"queue",
"and",
"returns",
"its",
"internal",
"name",
"panics",
"if",
"StartConsuming",
"wasn",
"t",
"called",
"before!"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L242-L247 |
22,810 | adjust/rmq | queue.go | AddBatchConsumer | func (queue *redisQueue) AddBatchConsumer(tag string, batchSize int, consumer BatchConsumer) string {
return queue.AddBatchConsumerWithTimeout(tag, batchSize, defaultBatchTimeout, consumer)
} | go | func (queue *redisQueue) AddBatchConsumer(tag string, batchSize int, consumer BatchConsumer) string {
return queue.AddBatchConsumerWithTimeout(tag, batchSize, defaultBatchTimeout, consumer)
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"AddBatchConsumer",
"(",
"tag",
"string",
",",
"batchSize",
"int",
",",
"consumer",
"BatchConsumer",
")",
"string",
"{",
"return",
"queue",
".",
"AddBatchConsumerWithTimeout",
"(",
"tag",
",",
"batchSize",
",",
"de... | // AddBatchConsumer is similar to AddConsumer, but for batches of deliveries | [
"AddBatchConsumer",
"is",
"similar",
"to",
"AddConsumer",
"but",
"for",
"batches",
"of",
"deliveries"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L254-L256 |
22,811 | adjust/rmq | queue.go | AddBatchConsumerWithTimeout | func (queue *redisQueue) AddBatchConsumerWithTimeout(tag string, batchSize int, timeout time.Duration, consumer BatchConsumer) string {
queue.stopWg.Add(1)
name := queue.addConsumer(tag)
go queue.consumerBatchConsume(batchSize, timeout, consumer)
return name
} | go | func (queue *redisQueue) AddBatchConsumerWithTimeout(tag string, batchSize int, timeout time.Duration, consumer BatchConsumer) string {
queue.stopWg.Add(1)
name := queue.addConsumer(tag)
go queue.consumerBatchConsume(batchSize, timeout, consumer)
return name
} | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"AddBatchConsumerWithTimeout",
"(",
"tag",
"string",
",",
"batchSize",
"int",
",",
"timeout",
"time",
".",
"Duration",
",",
"consumer",
"BatchConsumer",
")",
"string",
"{",
"queue",
".",
"stopWg",
".",
"Add",
"("... | // Timeout limits the amount of time waiting to fill an entire batch
// The timer is only started when the first message in a batch is received | [
"Timeout",
"limits",
"the",
"amount",
"of",
"time",
"waiting",
"to",
"fill",
"an",
"entire",
"batch",
"The",
"timer",
"is",
"only",
"started",
"when",
"the",
"first",
"message",
"in",
"a",
"batch",
"is",
"received"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L260-L265 |
22,812 | adjust/rmq | queue.go | consumeBatch | func (queue *redisQueue) consumeBatch(batchSize int) bool {
if batchSize == 0 {
return false
}
for i := 0; i < batchSize; i++ {
value, ok := queue.redisClient.RPopLPush(queue.readyKey, queue.unackedKey)
if !ok {
// debug(fmt.Sprintf("rmq queue consumed last batch %s %d", queue, i)) // COMMENTOUT
return ... | go | func (queue *redisQueue) consumeBatch(batchSize int) bool {
if batchSize == 0 {
return false
}
for i := 0; i < batchSize; i++ {
value, ok := queue.redisClient.RPopLPush(queue.readyKey, queue.unackedKey)
if !ok {
// debug(fmt.Sprintf("rmq queue consumed last batch %s %d", queue, i)) // COMMENTOUT
return ... | [
"func",
"(",
"queue",
"*",
"redisQueue",
")",
"consumeBatch",
"(",
"batchSize",
"int",
")",
"bool",
"{",
"if",
"batchSize",
"==",
"0",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"batchSize",
";",
"i",
"++",
"{"... | // consumeBatch tries to read batchSize deliveries, returns true if any and all were consumed | [
"consumeBatch",
"tries",
"to",
"read",
"batchSize",
"deliveries",
"returns",
"true",
"if",
"any",
"and",
"all",
"were",
"consumed"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/queue.go#L326-L344 |
22,813 | adjust/rmq | connection.go | OpenConnectionWithRedisClient | func OpenConnectionWithRedisClient(tag string, redisClient *redis.Client) *redisConnection {
return openConnectionWithRedisClient(tag, RedisWrapper{redisClient})
} | go | func OpenConnectionWithRedisClient(tag string, redisClient *redis.Client) *redisConnection {
return openConnectionWithRedisClient(tag, RedisWrapper{redisClient})
} | [
"func",
"OpenConnectionWithRedisClient",
"(",
"tag",
"string",
",",
"redisClient",
"*",
"redis",
".",
"Client",
")",
"*",
"redisConnection",
"{",
"return",
"openConnectionWithRedisClient",
"(",
"tag",
",",
"RedisWrapper",
"{",
"redisClient",
"}",
")",
"\n",
"}"
] | // OpenConnectionWithRedisClient opens and returns a new connection | [
"OpenConnectionWithRedisClient",
"opens",
"and",
"returns",
"a",
"new",
"connection"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L33-L35 |
22,814 | adjust/rmq | connection.go | OpenConnection | func OpenConnection(tag, network, address string, db int) *redisConnection {
redisClient := redis.NewClient(&redis.Options{
Network: network,
Addr: address,
DB: db,
})
return OpenConnectionWithRedisClient(tag, redisClient)
} | go | func OpenConnection(tag, network, address string, db int) *redisConnection {
redisClient := redis.NewClient(&redis.Options{
Network: network,
Addr: address,
DB: db,
})
return OpenConnectionWithRedisClient(tag, redisClient)
} | [
"func",
"OpenConnection",
"(",
"tag",
",",
"network",
",",
"address",
"string",
",",
"db",
"int",
")",
"*",
"redisConnection",
"{",
"redisClient",
":=",
"redis",
".",
"NewClient",
"(",
"&",
"redis",
".",
"Options",
"{",
"Network",
":",
"network",
",",
"A... | // OpenConnection opens and returns a new connection | [
"OpenConnection",
"opens",
"and",
"returns",
"a",
"new",
"connection"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L66-L73 |
22,815 | adjust/rmq | connection.go | OpenQueue | func (connection *redisConnection) OpenQueue(name string) Queue {
connection.redisClient.SAdd(queuesKey, name)
queue := newQueue(name, connection.Name, connection.queuesKey, connection.redisClient)
return queue
} | go | func (connection *redisConnection) OpenQueue(name string) Queue {
connection.redisClient.SAdd(queuesKey, name)
queue := newQueue(name, connection.Name, connection.queuesKey, connection.redisClient)
return queue
} | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"OpenQueue",
"(",
"name",
"string",
")",
"Queue",
"{",
"connection",
".",
"redisClient",
".",
"SAdd",
"(",
"queuesKey",
",",
"name",
")",
"\n",
"queue",
":=",
"newQueue",
"(",
"name",
",",
"connection... | // OpenQueue opens and returns the queue with a given name | [
"OpenQueue",
"opens",
"and",
"returns",
"the",
"queue",
"with",
"a",
"given",
"name"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L76-L80 |
22,816 | adjust/rmq | connection.go | Check | func (connection *redisConnection) Check() bool {
heartbeatKey := strings.Replace(connectionHeartbeatTemplate, phConnection, connection.Name, 1)
ttl, _ := connection.redisClient.TTL(heartbeatKey)
return ttl > 0
} | go | func (connection *redisConnection) Check() bool {
heartbeatKey := strings.Replace(connectionHeartbeatTemplate, phConnection, connection.Name, 1)
ttl, _ := connection.redisClient.TTL(heartbeatKey)
return ttl > 0
} | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"Check",
"(",
")",
"bool",
"{",
"heartbeatKey",
":=",
"strings",
".",
"Replace",
"(",
"connectionHeartbeatTemplate",
",",
"phConnection",
",",
"connection",
".",
"Name",
",",
"1",
")",
"\n",
"ttl",
",",... | // Check retuns true if the connection is currently active in terms of heartbeat | [
"Check",
"retuns",
"true",
"if",
"the",
"connection",
"is",
"currently",
"active",
"in",
"terms",
"of",
"heartbeat"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L96-L100 |
22,817 | adjust/rmq | connection.go | StopHeartbeat | func (connection *redisConnection) StopHeartbeat() bool {
connection.heartbeatStopped = true
_, ok := connection.redisClient.Del(connection.heartbeatKey)
return ok
} | go | func (connection *redisConnection) StopHeartbeat() bool {
connection.heartbeatStopped = true
_, ok := connection.redisClient.Del(connection.heartbeatKey)
return ok
} | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"StopHeartbeat",
"(",
")",
"bool",
"{",
"connection",
".",
"heartbeatStopped",
"=",
"true",
"\n",
"_",
",",
"ok",
":=",
"connection",
".",
"redisClient",
".",
"Del",
"(",
"connection",
".",
"heartbeatKe... | // StopHeartbeat stops the heartbeat of the connection
// it does not remove it from the list of connections so it can later be found by the cleaner | [
"StopHeartbeat",
"stops",
"the",
"heartbeat",
"of",
"the",
"connection",
"it",
"does",
"not",
"remove",
"it",
"from",
"the",
"list",
"of",
"connections",
"so",
"it",
"can",
"later",
"be",
"found",
"by",
"the",
"cleaner"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L104-L108 |
22,818 | adjust/rmq | connection.go | CloseAllQueues | func (connection *redisConnection) CloseAllQueues() int {
count, _ := connection.redisClient.Del(queuesKey)
return count
} | go | func (connection *redisConnection) CloseAllQueues() int {
count, _ := connection.redisClient.Del(queuesKey)
return count
} | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"CloseAllQueues",
"(",
")",
"int",
"{",
"count",
",",
"_",
":=",
"connection",
".",
"redisClient",
".",
"Del",
"(",
"queuesKey",
")",
"\n",
"return",
"count",
"\n",
"}"
] | // CloseAllQueues closes all queues by removing them from the global list | [
"CloseAllQueues",
"closes",
"all",
"queues",
"by",
"removing",
"them",
"from",
"the",
"global",
"list"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L121-L124 |
22,819 | adjust/rmq | connection.go | CloseAllQueuesInConnection | func (connection *redisConnection) CloseAllQueuesInConnection() error {
connection.redisClient.Del(connection.queuesKey)
// debug(fmt.Sprintf("connection closed all queues %s %d", connection, connection.queuesKey)) // COMMENTOUT
return nil
} | go | func (connection *redisConnection) CloseAllQueuesInConnection() error {
connection.redisClient.Del(connection.queuesKey)
// debug(fmt.Sprintf("connection closed all queues %s %d", connection, connection.queuesKey)) // COMMENTOUT
return nil
} | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"CloseAllQueuesInConnection",
"(",
")",
"error",
"{",
"connection",
".",
"redisClient",
".",
"Del",
"(",
"connection",
".",
"queuesKey",
")",
"\n",
"// debug(fmt.Sprintf(\"connection closed all queues %s %d\", connec... | // CloseAllQueuesInConnection closes all queues in the associated connection by removing all related keys | [
"CloseAllQueuesInConnection",
"closes",
"all",
"queues",
"in",
"the",
"associated",
"connection",
"by",
"removing",
"all",
"related",
"keys"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L127-L131 |
22,820 | adjust/rmq | connection.go | heartbeat | func (connection *redisConnection) heartbeat() {
for {
if !connection.updateHeartbeat() {
// log.Printf("rmq connection failed to update heartbeat %s", connection)
}
time.Sleep(time.Second)
if connection.heartbeatStopped {
// log.Printf("rmq connection stopped heartbeat %s", connection)
return
}
... | go | func (connection *redisConnection) heartbeat() {
for {
if !connection.updateHeartbeat() {
// log.Printf("rmq connection failed to update heartbeat %s", connection)
}
time.Sleep(time.Second)
if connection.heartbeatStopped {
// log.Printf("rmq connection stopped heartbeat %s", connection)
return
}
... | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"heartbeat",
"(",
")",
"{",
"for",
"{",
"if",
"!",
"connection",
".",
"updateHeartbeat",
"(",
")",
"{",
"// log.Printf(\"rmq connection failed to update heartbeat %s\", connection)",
"}",
"\n\n",
"time",
".",
"... | // heartbeat keeps the heartbeat key alive | [
"heartbeat",
"keeps",
"the",
"heartbeat",
"key",
"alive"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L139-L152 |
22,821 | adjust/rmq | connection.go | hijackConnection | func (connection *redisConnection) hijackConnection(name string) *redisConnection {
return &redisConnection{
Name: name,
heartbeatKey: strings.Replace(connectionHeartbeatTemplate, phConnection, name, 1),
queuesKey: strings.Replace(connectionQueuesTemplate, phConnection, name, 1),
redisClient: conne... | go | func (connection *redisConnection) hijackConnection(name string) *redisConnection {
return &redisConnection{
Name: name,
heartbeatKey: strings.Replace(connectionHeartbeatTemplate, phConnection, name, 1),
queuesKey: strings.Replace(connectionQueuesTemplate, phConnection, name, 1),
redisClient: conne... | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"hijackConnection",
"(",
"name",
"string",
")",
"*",
"redisConnection",
"{",
"return",
"&",
"redisConnection",
"{",
"Name",
":",
"name",
",",
"heartbeatKey",
":",
"strings",
".",
"Replace",
"(",
"connecti... | // hijackConnection reopens an existing connection for inspection purposes without starting a heartbeat | [
"hijackConnection",
"reopens",
"an",
"existing",
"connection",
"for",
"inspection",
"purposes",
"without",
"starting",
"a",
"heartbeat"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L160-L167 |
22,822 | adjust/rmq | connection.go | openQueue | func (connection *redisConnection) openQueue(name string) *redisQueue {
return newQueue(name, connection.Name, connection.queuesKey, connection.redisClient)
} | go | func (connection *redisConnection) openQueue(name string) *redisQueue {
return newQueue(name, connection.Name, connection.queuesKey, connection.redisClient)
} | [
"func",
"(",
"connection",
"*",
"redisConnection",
")",
"openQueue",
"(",
"name",
"string",
")",
"*",
"redisQueue",
"{",
"return",
"newQueue",
"(",
"name",
",",
"connection",
".",
"Name",
",",
"connection",
".",
"queuesKey",
",",
"connection",
".",
"redisCli... | // openQueue opens a queue without adding it to the set of queues | [
"openQueue",
"opens",
"a",
"queue",
"without",
"adding",
"it",
"to",
"the",
"set",
"of",
"queues"
] | d0da8bbb71c869171bf054c3ae60ecee3012b249 | https://github.com/adjust/rmq/blob/d0da8bbb71c869171bf054c3ae60ecee3012b249/connection.go#L170-L172 |
22,823 | vdobler/chart | chart.go | Reset | func (r *Range) Reset() {
r.Min, r.Max = 0, 0
r.TMin, r.TMax = time.Time{}, time.Time{}
r.Tics = nil
r.Norm, r.InvNorm = nil, nil
r.Data2Screen, r.Screen2Data = nil, nil
if !r.TicSetting.UserDelta {
r.TicSetting.Delta = 0
r.TicSetting.TDelta = nil
}
} | go | func (r *Range) Reset() {
r.Min, r.Max = 0, 0
r.TMin, r.TMax = time.Time{}, time.Time{}
r.Tics = nil
r.Norm, r.InvNorm = nil, nil
r.Data2Screen, r.Screen2Data = nil, nil
if !r.TicSetting.UserDelta {
r.TicSetting.Delta = 0
r.TicSetting.TDelta = nil
}
} | [
"func",
"(",
"r",
"*",
"Range",
")",
"Reset",
"(",
")",
"{",
"r",
".",
"Min",
",",
"r",
".",
"Max",
"=",
"0",
",",
"0",
"\n",
"r",
".",
"TMin",
",",
"r",
".",
"TMax",
"=",
"time",
".",
"Time",
"{",
"}",
",",
"time",
".",
"Time",
"{",
"}... | // Reset the fields in r which have been set up during a plot. | [
"Reset",
"the",
"fields",
"in",
"r",
"which",
"have",
"been",
"set",
"up",
"during",
"a",
"plot",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/chart.go#L143-L154 |
22,824 | vdobler/chart | chart.go | autoscale | func (r *Range) autoscale(x float64) {
if x < r.DataMin && !r.MinMode.Fixed {
if !r.MinMode.Constrained {
// full autoscaling
r.DataMin = x
} else {
r.DataMin = fmin(fmax(x, r.MinMode.Lower), r.DataMin)
}
}
if x > r.DataMax && !r.MaxMode.Fixed {
if !r.MaxMode.Constrained {
// full autoscaling
... | go | func (r *Range) autoscale(x float64) {
if x < r.DataMin && !r.MinMode.Fixed {
if !r.MinMode.Constrained {
// full autoscaling
r.DataMin = x
} else {
r.DataMin = fmin(fmax(x, r.MinMode.Lower), r.DataMin)
}
}
if x > r.DataMax && !r.MaxMode.Fixed {
if !r.MaxMode.Constrained {
// full autoscaling
... | [
"func",
"(",
"r",
"*",
"Range",
")",
"autoscale",
"(",
"x",
"float64",
")",
"{",
"if",
"x",
"<",
"r",
".",
"DataMin",
"&&",
"!",
"r",
".",
"MinMode",
".",
"Fixed",
"{",
"if",
"!",
"r",
".",
"MinMode",
".",
"Constrained",
"{",
"// full autoscaling",... | // Update DataMin and DataMax according to the RangeModes. | [
"Update",
"DataMin",
"and",
"DataMax",
"according",
"to",
"the",
"RangeModes",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/chart.go#L213-L232 |
22,825 | vdobler/chart | box.go | AddData | func (c *BoxChart) AddData(name string, data []Box, style Style) {
c.Data = append(c.Data, BoxChartData{name, style, data})
ps := PlotStyle(PlotStylePoints | PlotStyleBox)
c.Key.Entries = append(c.Key.Entries, KeyEntry{Text: name, Style: style, PlotStyle: ps})
// TODO(vodo) min, max
} | go | func (c *BoxChart) AddData(name string, data []Box, style Style) {
c.Data = append(c.Data, BoxChartData{name, style, data})
ps := PlotStyle(PlotStylePoints | PlotStyleBox)
c.Key.Entries = append(c.Key.Entries, KeyEntry{Text: name, Style: style, PlotStyle: ps})
// TODO(vodo) min, max
} | [
"func",
"(",
"c",
"*",
"BoxChart",
")",
"AddData",
"(",
"name",
"string",
",",
"data",
"[",
"]",
"Box",
",",
"style",
"Style",
")",
"{",
"c",
".",
"Data",
"=",
"append",
"(",
"c",
".",
"Data",
",",
"BoxChartData",
"{",
"name",
",",
"style",
",",
... | // AddData adds all boxes in data to the chart. | [
"AddData",
"adds",
"all",
"boxes",
"in",
"data",
"to",
"the",
"chart",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/box.go#L32-L37 |
22,826 | vdobler/chart | scatter.go | AddDataGeneric | func (c *ScatterChart) AddDataGeneric(name string, data []XYErrValue, plotstyle PlotStyle, style Style) {
edata := make([]EPoint, len(data))
for i, d := range data {
x, y := d.XVal(), d.YVal()
xl, xh := d.XErr()
yl, yh := d.YErr()
dx, dy := xh-xl, yh-yl
xo, yo := xh-dx/2-x, yh-dy/2-y
edata[i] = EPoint{X: ... | go | func (c *ScatterChart) AddDataGeneric(name string, data []XYErrValue, plotstyle PlotStyle, style Style) {
edata := make([]EPoint, len(data))
for i, d := range data {
x, y := d.XVal(), d.YVal()
xl, xh := d.XErr()
yl, yh := d.YErr()
dx, dy := xh-xl, yh-yl
xo, yo := xh-dx/2-x, yh-dy/2-y
edata[i] = EPoint{X: ... | [
"func",
"(",
"c",
"*",
"ScatterChart",
")",
"AddDataGeneric",
"(",
"name",
"string",
",",
"data",
"[",
"]",
"XYErrValue",
",",
"plotstyle",
"PlotStyle",
",",
"style",
"Style",
")",
"{",
"edata",
":=",
"make",
"(",
"[",
"]",
"EPoint",
",",
"len",
"(",
... | // AddDataGeneric is the generiv version of AddData which allows any type
// to be plotted that implements the XYErrValue interface. | [
"AddDataGeneric",
"is",
"the",
"generiv",
"version",
"of",
"AddData",
"which",
"allows",
"any",
"type",
"to",
"be",
"plotted",
"that",
"implements",
"the",
"XYErrValue",
"interface",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/scatter.go#L97-L108 |
22,827 | vdobler/chart | scatter.go | Plot | func (c *ScatterChart) Plot(g Graphics) {
layout := layout(g, c.Title, c.XRange.Label, c.YRange.Label,
c.XRange.TicSetting.Hide || c.XRange.TicSetting.HideLabels,
c.YRange.TicSetting.Hide || c.YRange.TicSetting.HideLabels,
&c.Key)
width, height := layout.Width, layout.Height
topm, leftm := layout.Top, layout.... | go | func (c *ScatterChart) Plot(g Graphics) {
layout := layout(g, c.Title, c.XRange.Label, c.YRange.Label,
c.XRange.TicSetting.Hide || c.XRange.TicSetting.HideLabels,
c.YRange.TicSetting.Hide || c.YRange.TicSetting.HideLabels,
&c.Key)
width, height := layout.Width, layout.Height
topm, leftm := layout.Top, layout.... | [
"func",
"(",
"c",
"*",
"ScatterChart",
")",
"Plot",
"(",
"g",
"Graphics",
")",
"{",
"layout",
":=",
"layout",
"(",
"g",
",",
"c",
".",
"Title",
",",
"c",
".",
"XRange",
".",
"Label",
",",
"c",
".",
"YRange",
".",
"Label",
",",
"c",
".",
"XRange... | // Plot outputs the scatter chart to the graphic output g. | [
"Plot",
"outputs",
"the",
"scatter",
"chart",
"to",
"the",
"graphic",
"output",
"g",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/scatter.go#L129-L182 |
22,828 | vdobler/chart | scatter.go | clipPoint | func (c *ScatterChart) clipPoint(in, out EPoint, min, max float64) (p EPoint) {
// fmt.Printf("clipPoint: in (%g,%g), out(%g,%g) min/max=%g/%g\n", in.X, in.Y, out.X, out.Y, min, max)
dx, dy := in.X-out.X, in.Y-out.Y
var y float64
if out.Y <= min {
y = min
} else {
y = max
}
x := in.X + dx*(y-in.Y)/dy
p.X,... | go | func (c *ScatterChart) clipPoint(in, out EPoint, min, max float64) (p EPoint) {
// fmt.Printf("clipPoint: in (%g,%g), out(%g,%g) min/max=%g/%g\n", in.X, in.Y, out.X, out.Y, min, max)
dx, dy := in.X-out.X, in.Y-out.Y
var y float64
if out.Y <= min {
y = min
} else {
y = max
}
x := in.X + dx*(y-in.Y)/dy
p.X,... | [
"func",
"(",
"c",
"*",
"ScatterChart",
")",
"clipPoint",
"(",
"in",
",",
"out",
"EPoint",
",",
"min",
",",
"max",
"float64",
")",
"(",
"p",
"EPoint",
")",
"{",
"// fmt.Printf(\"clipPoint: in (%g,%g), out(%g,%g) min/max=%g/%g\\n\", in.X, in.Y, out.X, out.Y, min, max)",
... | // Point in is in valid y range, out is out. Return p which clips the line from in to out to valid y range | [
"Point",
"in",
"is",
"in",
"valid",
"y",
"range",
"out",
"is",
"out",
".",
"Return",
"p",
"which",
"clips",
"the",
"line",
"from",
"in",
"to",
"out",
"to",
"valid",
"y",
"range"
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/scatter.go#L267-L281 |
22,829 | vdobler/chart | scatter.go | screenPointFunc | func screenPointFunc(xf, yf func(float64) int, xmin, xmax, ymin, ymax float64) (spf func(EPoint) EPoint) {
spf = func(d EPoint) (p EPoint) {
xl, yl, xh, yh := d.BoundingBox()
// fmt.Printf("OrigBB: %.1f %.1f %.1f %.1f (%.1f,%.1f)\n", xl,yl,xh,yh,d.X,d.Y)
if xl < xmin {
xl = xmin
}
if xh > xmax {
xh = ... | go | func screenPointFunc(xf, yf func(float64) int, xmin, xmax, ymin, ymax float64) (spf func(EPoint) EPoint) {
spf = func(d EPoint) (p EPoint) {
xl, yl, xh, yh := d.BoundingBox()
// fmt.Printf("OrigBB: %.1f %.1f %.1f %.1f (%.1f,%.1f)\n", xl,yl,xh,yh,d.X,d.Y)
if xl < xmin {
xl = xmin
}
if xh > xmax {
xh = ... | [
"func",
"screenPointFunc",
"(",
"xf",
",",
"yf",
"func",
"(",
"float64",
")",
"int",
",",
"xmin",
",",
"xmax",
",",
"ymin",
",",
"ymax",
"float64",
")",
"(",
"spf",
"func",
"(",
"EPoint",
")",
"EPoint",
")",
"{",
"spf",
"=",
"func",
"(",
"d",
"EP... | // Set up function which handles mappig data->screen coordinates and does
// proper clipping on the error bars. | [
"Set",
"up",
"function",
"which",
"handles",
"mappig",
"data",
"-",
">",
"screen",
"coordinates",
"and",
"does",
"proper",
"clipping",
"on",
"the",
"error",
"bars",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/scatter.go#L304-L384 |
22,830 | vdobler/chart | imgg/image.go | New | func New(width, height int, bgcol color.RGBA, font *truetype.Font, fontsize map[chart.FontSize]float64) *ImageGraphics {
img := image.NewRGBA(image.Rect(0, 0, width, height))
gc := draw2dimg.NewGraphicContext(img)
gc.SetLineJoin(draw2d.BevelJoin)
gc.SetLineCap(draw2d.SquareCap)
gc.SetStrokeColor(image.Black)
gc.S... | go | func New(width, height int, bgcol color.RGBA, font *truetype.Font, fontsize map[chart.FontSize]float64) *ImageGraphics {
img := image.NewRGBA(image.Rect(0, 0, width, height))
gc := draw2dimg.NewGraphicContext(img)
gc.SetLineJoin(draw2d.BevelJoin)
gc.SetLineCap(draw2d.SquareCap)
gc.SetStrokeColor(image.Black)
gc.S... | [
"func",
"New",
"(",
"width",
",",
"height",
"int",
",",
"bgcol",
"color",
".",
"RGBA",
",",
"font",
"*",
"truetype",
".",
"Font",
",",
"fontsize",
"map",
"[",
"chart",
".",
"FontSize",
"]",
"float64",
")",
"*",
"ImageGraphics",
"{",
"img",
":=",
"ima... | // New creates a new ImageGraphics including an image.RGBA of dimension w x h
// with background bgcol. If font is nil it will use a builtin font.
// If fontsize is empty useful default are used. | [
"New",
"creates",
"a",
"new",
"ImageGraphics",
"including",
"an",
"image",
".",
"RGBA",
"of",
"dimension",
"w",
"x",
"h",
"with",
"background",
"bgcol",
".",
"If",
"font",
"is",
"nil",
"it",
"will",
"use",
"a",
"builtin",
"font",
".",
"If",
"fontsize",
... | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/imgg/image.go#L46-L63 |
22,831 | vdobler/chart | imgg/image.go | textBox | func (ig *ImageGraphics) textBox(t string, font chart.Font, textCol color.Color) image.Image {
// Initialize the context.
bg := image.NewUniform(color.Alpha{0})
fg := image.NewUniform(textCol)
width := ig.TextLen(t, font)
size := ig.relFontsizeToPixel(font.Size)
c := freetype.NewContext()
c.SetDPI(dpi)
c.SetFo... | go | func (ig *ImageGraphics) textBox(t string, font chart.Font, textCol color.Color) image.Image {
// Initialize the context.
bg := image.NewUniform(color.Alpha{0})
fg := image.NewUniform(textCol)
width := ig.TextLen(t, font)
size := ig.relFontsizeToPixel(font.Size)
c := freetype.NewContext()
c.SetDPI(dpi)
c.SetFo... | [
"func",
"(",
"ig",
"*",
"ImageGraphics",
")",
"textBox",
"(",
"t",
"string",
",",
"font",
"chart",
".",
"Font",
",",
"textCol",
"color",
".",
"Color",
")",
"image",
".",
"Image",
"{",
"// Initialize the context.",
"bg",
":=",
"image",
".",
"NewUniform",
... | // textBox renders t into a tight fitting image | [
"textBox",
"renders",
"t",
"into",
"a",
"tight",
"fitting",
"image"
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/imgg/image.go#L246-L281 |
22,832 | vdobler/chart | txtg/text.go | New | func New(w, h int) *TextGraphics {
tg := TextGraphics{}
tg.tb = NewTextBuf(w, h)
tg.w, tg.h = w, h
tg.xoff = -1
return &tg
} | go | func New(w, h int) *TextGraphics {
tg := TextGraphics{}
tg.tb = NewTextBuf(w, h)
tg.w, tg.h = w, h
tg.xoff = -1
return &tg
} | [
"func",
"New",
"(",
"w",
",",
"h",
"int",
")",
"*",
"TextGraphics",
"{",
"tg",
":=",
"TextGraphics",
"{",
"}",
"\n",
"tg",
".",
"tb",
"=",
"NewTextBuf",
"(",
"w",
",",
"h",
")",
"\n",
"tg",
".",
"w",
",",
"tg",
".",
"h",
"=",
"w",
",",
"h",... | // New creates a TextGraphic of dimensions w x h. | [
"New",
"creates",
"a",
"TextGraphic",
"of",
"dimensions",
"w",
"x",
"h",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/txtg/text.go#L17-L23 |
22,833 | vdobler/chart | hist.go | AddData | func (c *HistChart) AddData(name string, data []float64, style Style) {
// Style
if style.empty() {
style = AutoStyle(len(c.Data), true)
}
// Init axis, add data, autoscale
if len(c.Data) == 0 {
c.XRange.init()
}
c.Data = append(c.Data, HistChartData{name, style, data})
for _, d := range data {
c.XRange.... | go | func (c *HistChart) AddData(name string, data []float64, style Style) {
// Style
if style.empty() {
style = AutoStyle(len(c.Data), true)
}
// Init axis, add data, autoscale
if len(c.Data) == 0 {
c.XRange.init()
}
c.Data = append(c.Data, HistChartData{name, style, data})
for _, d := range data {
c.XRange.... | [
"func",
"(",
"c",
"*",
"HistChart",
")",
"AddData",
"(",
"name",
"string",
",",
"data",
"[",
"]",
"float64",
",",
"style",
"Style",
")",
"{",
"// Style",
"if",
"style",
".",
"empty",
"(",
")",
"{",
"style",
"=",
"AutoStyle",
"(",
"len",
"(",
"c",
... | // AddData will add data to the plot. Legend will be updated by name. | [
"AddData",
"will",
"add",
"data",
"to",
"the",
"plot",
".",
"Legend",
"will",
"be",
"updated",
"by",
"name",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/hist.go#L93-L112 |
22,834 | vdobler/chart | hist.go | AddDataGeneric | func (c *HistChart) AddDataGeneric(name string, data []Value, style Style) {
fdata := make([]float64, len(data))
for i, d := range data {
fdata[i] = d.XVal()
}
c.AddData(name, fdata, style)
} | go | func (c *HistChart) AddDataGeneric(name string, data []Value, style Style) {
fdata := make([]float64, len(data))
for i, d := range data {
fdata[i] = d.XVal()
}
c.AddData(name, fdata, style)
} | [
"func",
"(",
"c",
"*",
"HistChart",
")",
"AddDataGeneric",
"(",
"name",
"string",
",",
"data",
"[",
"]",
"Value",
",",
"style",
"Style",
")",
"{",
"fdata",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"len",
"(",
"data",
")",
")",
"\n",
"for",
"i... | // AddDataGeneric is the generic version which allows the addition of any type
// implementing the Value interface. | [
"AddDataGeneric",
"is",
"the",
"generic",
"version",
"which",
"allows",
"the",
"addition",
"of",
"any",
"type",
"implementing",
"the",
"Value",
"interface",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/hist.go#L126-L132 |
22,835 | vdobler/chart | hist.go | binify | func (c *HistChart) binify(binStart, binWidth float64, binCnt int) (freqs [][]float64, max float64) {
x2bin := func(x float64) int { return int((x - binStart) / binWidth) }
freqs = make([][]float64, len(c.Data)) // freqs[d][b] is frequency/count of bin b in dataset d
max = 0
for i, data := range c.Data {
freq :=... | go | func (c *HistChart) binify(binStart, binWidth float64, binCnt int) (freqs [][]float64, max float64) {
x2bin := func(x float64) int { return int((x - binStart) / binWidth) }
freqs = make([][]float64, len(c.Data)) // freqs[d][b] is frequency/count of bin b in dataset d
max = 0
for i, data := range c.Data {
freq :=... | [
"func",
"(",
"c",
"*",
"HistChart",
")",
"binify",
"(",
"binStart",
",",
"binWidth",
"float64",
",",
"binCnt",
"int",
")",
"(",
"freqs",
"[",
"]",
"[",
"]",
"float64",
",",
"max",
"float64",
")",
"{",
"x2bin",
":=",
"func",
"(",
"x",
"float64",
")"... | // Prepare binCnt bins of width binWidth starting from binStart and count
// data samples per bin for each data set. If c.Counts is true than the
// absolute counts are returned instead if the frequencies. max is the
// largest y-value which will occur in our plot. | [
"Prepare",
"binCnt",
"bins",
"of",
"width",
"binWidth",
"starting",
"from",
"binStart",
"and",
"count",
"data",
"samples",
"per",
"bin",
"for",
"each",
"data",
"set",
".",
"If",
"c",
".",
"Counts",
"is",
"true",
"than",
"the",
"absolute",
"counts",
"are",
... | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/hist.go#L181-L230 |
22,836 | vdobler/chart | time.go | RoundUp | func RoundUp(t time.Time, d TimeDelta) time.Time {
// works only because all TimeDeltas are more than 1.5 times as large as the next lower
shift := d.Seconds()
shift += shift / 2
t = d.RoundDown(t)
t = t.Add(time.Duration(shift) * time.Second)
t = d.RoundDown(t)
DebugLogger.Printf("RoundUp( %s, %s ) --> %s ", t.... | go | func RoundUp(t time.Time, d TimeDelta) time.Time {
// works only because all TimeDeltas are more than 1.5 times as large as the next lower
shift := d.Seconds()
shift += shift / 2
t = d.RoundDown(t)
t = t.Add(time.Duration(shift) * time.Second)
t = d.RoundDown(t)
DebugLogger.Printf("RoundUp( %s, %s ) --> %s ", t.... | [
"func",
"RoundUp",
"(",
"t",
"time",
".",
"Time",
",",
"d",
"TimeDelta",
")",
"time",
".",
"Time",
"{",
"// works only because all TimeDeltas are more than 1.5 times as large as the next lower",
"shift",
":=",
"d",
".",
"Seconds",
"(",
")",
"\n",
"shift",
"+=",
"s... | // RoundUp will round tp up to next "full" d. | [
"RoundUp",
"will",
"round",
"tp",
"up",
"to",
"next",
"full",
"d",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/time.go#L170-L180 |
22,837 | vdobler/chart | time.go | RoundNext | func RoundNext(t time.Time, d TimeDelta) time.Time {
DebugLogger.Printf("RoundNext( %s, %s )", t.Format("2006-01-02 15:04:05 (Mon)"), d.String())
os := t.Unix()
lt := d.RoundDown(t)
shift := d.Seconds()
shift += shift / 2
ut := lt.Add(time.Duration(shift) * time.Second) // see RoundUp()
ut = d.RoundDown(ut)
ld ... | go | func RoundNext(t time.Time, d TimeDelta) time.Time {
DebugLogger.Printf("RoundNext( %s, %s )", t.Format("2006-01-02 15:04:05 (Mon)"), d.String())
os := t.Unix()
lt := d.RoundDown(t)
shift := d.Seconds()
shift += shift / 2
ut := lt.Add(time.Duration(shift) * time.Second) // see RoundUp()
ut = d.RoundDown(ut)
ld ... | [
"func",
"RoundNext",
"(",
"t",
"time",
".",
"Time",
",",
"d",
"TimeDelta",
")",
"time",
".",
"Time",
"{",
"DebugLogger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"t",
".",
"Format",
"(",
"\"",
"\"",
")",
",",
"d",
".",
"String",
"(",
")",
")",
"\n"... | // RoundNext will round t to nearest full d. | [
"RoundNext",
"will",
"round",
"t",
"to",
"nearest",
"full",
"d",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/time.go#L183-L197 |
22,838 | vdobler/chart | time.go | RoundDown | func RoundDown(t time.Time, d TimeDelta) time.Time {
td := d.RoundDown(t)
DebugLogger.Printf("RoundDown( %s, %s ) --> %s", t.Format("2006-01-02 15:04:05 (Mon)"), d.String(),
td.Format("2006-01-02 15:04:05 (Mon)"))
return td
} | go | func RoundDown(t time.Time, d TimeDelta) time.Time {
td := d.RoundDown(t)
DebugLogger.Printf("RoundDown( %s, %s ) --> %s", t.Format("2006-01-02 15:04:05 (Mon)"), d.String(),
td.Format("2006-01-02 15:04:05 (Mon)"))
return td
} | [
"func",
"RoundDown",
"(",
"t",
"time",
".",
"Time",
",",
"d",
"TimeDelta",
")",
"time",
".",
"Time",
"{",
"td",
":=",
"d",
".",
"RoundDown",
"(",
"t",
")",
"\n",
"DebugLogger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"t",
".",
"Format",
"(",
"\"",
... | // RoundDown will round tp down to next "full" d. | [
"RoundDown",
"will",
"round",
"tp",
"down",
"to",
"next",
"full",
"d",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/time.go#L200-L205 |
22,839 | vdobler/chart | pie.go | PercentValue | func PercentValue(value, sum float64) (s string) {
value *= 100 / sum
s = AbsoluteValue(value, sum) + "% "
return
} | go | func PercentValue(value, sum float64) (s string) {
value *= 100 / sum
s = AbsoluteValue(value, sum) + "% "
return
} | [
"func",
"PercentValue",
"(",
"value",
",",
"sum",
"float64",
")",
"(",
"s",
"string",
")",
"{",
"value",
"*=",
"100",
"/",
"sum",
"\n",
"s",
"=",
"AbsoluteValue",
"(",
"value",
",",
"sum",
")",
"+",
"\"",
"\"",
"\n",
"return",
"\n",
"}"
] | // PercentValue formats value as percentage of sum.
// It is a convenience function which can be assigned to the
// PieChart.FmtVal or PieChart.FmtKey field. | [
"PercentValue",
"formats",
"value",
"as",
"percentage",
"of",
"sum",
".",
"It",
"is",
"a",
"convenience",
"function",
"which",
"can",
"be",
"assigned",
"to",
"the",
"PieChart",
".",
"FmtVal",
"or",
"PieChart",
".",
"FmtKey",
"field",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/pie.go#L57-L61 |
22,840 | vdobler/chart | pie.go | Plot | func (c *PieChart) Plot(g Graphics) {
layout := layout(g, c.Title, "", "", true, true, &c.Key)
width, height := layout.Width, layout.Height
topm, leftm := layout.Top, layout.Left
width += 0
r := imin(height, width) / 2
x0, y0 := leftm+r, topm+r
// Make sure pie fits into plotting area
rshift := int(float64(r... | go | func (c *PieChart) Plot(g Graphics) {
layout := layout(g, c.Title, "", "", true, true, &c.Key)
width, height := layout.Width, layout.Height
topm, leftm := layout.Top, layout.Left
width += 0
r := imin(height, width) / 2
x0, y0 := leftm+r, topm+r
// Make sure pie fits into plotting area
rshift := int(float64(r... | [
"func",
"(",
"c",
"*",
"PieChart",
")",
"Plot",
"(",
"g",
"Graphics",
")",
"{",
"layout",
":=",
"layout",
"(",
"g",
",",
"c",
".",
"Title",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"true",
",",
"true",
",",
"&",
"c",
".",
"Key",
")",
"\n\n",
... | // Plot outputs the scatter chart sc to g. | [
"Plot",
"outputs",
"the",
"scatter",
"chart",
"sc",
"to",
"g",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/pie.go#L121-L191 |
22,841 | vdobler/chart | graphics.go | GenericTextLen | func GenericTextLen(mg MinimalGraphics, t string, font Font) (width int) {
// TODO: how handle newlines? same way like Text does
fw, _, mono := mg.FontMetrics(font)
if mono {
for _ = range t {
width++
}
width = int(float32(width)*fw + 0.5)
} else {
var length float32
for _, r := range t {
if w, ok ... | go | func GenericTextLen(mg MinimalGraphics, t string, font Font) (width int) {
// TODO: how handle newlines? same way like Text does
fw, _, mono := mg.FontMetrics(font)
if mono {
for _ = range t {
width++
}
width = int(float32(width)*fw + 0.5)
} else {
var length float32
for _, r := range t {
if w, ok ... | [
"func",
"GenericTextLen",
"(",
"mg",
"MinimalGraphics",
",",
"t",
"string",
",",
"font",
"Font",
")",
"(",
"width",
"int",
")",
"{",
"// TODO: how handle newlines? same way like Text does",
"fw",
",",
"_",
",",
"mono",
":=",
"mg",
".",
"FontMetrics",
"(",
"fo... | // GenericTextLen tries to determine the width in pixel of t if rendered into mg in using font. | [
"GenericTextLen",
"tries",
"to",
"determine",
"the",
"width",
"in",
"pixel",
"of",
"t",
"if",
"rendered",
"into",
"mg",
"in",
"using",
"font",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/graphics.go#L72-L94 |
22,842 | vdobler/chart | graphics.go | GenericXAxis | func GenericXAxis(bg BasicGraphics, rng Range, y, ym int, options PlotOptions) {
_, fontheight, _ := bg.FontMetrics(elementStyle(options, MajorTicElement).Font)
var ticLen int = 0
if !rng.TicSetting.Hide {
ticLen = imin(12, imax(4, fontheight/2))
}
xa, xe := rng.Data2Screen(rng.Min), rng.Data2Screen(rng.Max)
/... | go | func GenericXAxis(bg BasicGraphics, rng Range, y, ym int, options PlotOptions) {
_, fontheight, _ := bg.FontMetrics(elementStyle(options, MajorTicElement).Font)
var ticLen int = 0
if !rng.TicSetting.Hide {
ticLen = imin(12, imax(4, fontheight/2))
}
xa, xe := rng.Data2Screen(rng.Min), rng.Data2Screen(rng.Max)
/... | [
"func",
"GenericXAxis",
"(",
"bg",
"BasicGraphics",
",",
"rng",
"Range",
",",
"y",
",",
"ym",
"int",
",",
"options",
"PlotOptions",
")",
"{",
"_",
",",
"fontheight",
",",
"_",
":=",
"bg",
".",
"FontMetrics",
"(",
"elementStyle",
"(",
"options",
",",
"M... | // GenericXAxis draws the x-axis with range rng solely by graphic primitives of bg.
// The x-axis is drawn at y on the screen and the mirrored x-axis is drawn at ym. | [
"GenericXAxis",
"draws",
"the",
"x",
"-",
"axis",
"with",
"range",
"rng",
"solely",
"by",
"graphic",
"primitives",
"of",
"bg",
".",
"The",
"x",
"-",
"axis",
"is",
"drawn",
"at",
"y",
"on",
"the",
"screen",
"and",
"the",
"mirrored",
"x",
"-",
"axis",
... | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/graphics.go#L206-L249 |
22,843 | vdobler/chart | graphics.go | GenericYAxis | func GenericYAxis(bg BasicGraphics, rng Range, x, xm int, options PlotOptions) {
font := elementStyle(options, MajorAxisElement).Font
_, fontheight, _ := bg.FontMetrics(font)
var ticLen int = 0
if !rng.TicSetting.Hide {
ticLen = imin(10, imax(4, fontheight/2))
}
ya, ye := rng.Data2Screen(rng.Min), rng.Data2Scre... | go | func GenericYAxis(bg BasicGraphics, rng Range, x, xm int, options PlotOptions) {
font := elementStyle(options, MajorAxisElement).Font
_, fontheight, _ := bg.FontMetrics(font)
var ticLen int = 0
if !rng.TicSetting.Hide {
ticLen = imin(10, imax(4, fontheight/2))
}
ya, ye := rng.Data2Screen(rng.Min), rng.Data2Scre... | [
"func",
"GenericYAxis",
"(",
"bg",
"BasicGraphics",
",",
"rng",
"Range",
",",
"x",
",",
"xm",
"int",
",",
"options",
"PlotOptions",
")",
"{",
"font",
":=",
"elementStyle",
"(",
"options",
",",
"MajorAxisElement",
")",
".",
"Font",
"\n",
"_",
",",
"fonthe... | // GenericYAxis draws the y-axis with the range rng solely by graphic primitives of bg.
// The y.axis and the mirrord y-axis are drawn at x and ym respectively. | [
"GenericYAxis",
"draws",
"the",
"y",
"-",
"axis",
"with",
"the",
"range",
"rng",
"solely",
"by",
"graphic",
"primitives",
"of",
"bg",
".",
"The",
"y",
".",
"axis",
"and",
"the",
"mirrord",
"y",
"-",
"axis",
"are",
"drawn",
"at",
"x",
"and",
"ym",
"re... | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/graphics.go#L320-L362 |
22,844 | vdobler/chart | graphics.go | GenericScatter | func GenericScatter(bg BasicGraphics, points []EPoint, plotstyle PlotStyle, style Style) {
// First pass: Error bars
ebs := style
ebs.LineColor, ebs.LineWidth, ebs.LineStyle = ebs.FillColor, 1, SolidLine
if ebs.LineColor == nil {
ebs.LineColor = color.NRGBA{0x40, 0x40, 0x40, 0xff}
}
if ebs.LineWidth == 0 {
e... | go | func GenericScatter(bg BasicGraphics, points []EPoint, plotstyle PlotStyle, style Style) {
// First pass: Error bars
ebs := style
ebs.LineColor, ebs.LineWidth, ebs.LineStyle = ebs.FillColor, 1, SolidLine
if ebs.LineColor == nil {
ebs.LineColor = color.NRGBA{0x40, 0x40, 0x40, 0xff}
}
if ebs.LineWidth == 0 {
e... | [
"func",
"GenericScatter",
"(",
"bg",
"BasicGraphics",
",",
"points",
"[",
"]",
"EPoint",
",",
"plotstyle",
"PlotStyle",
",",
"style",
"Style",
")",
"{",
"// First pass: Error bars",
"ebs",
":=",
"style",
"\n",
"ebs",
".",
"LineColor",
",",
"ebs",
".",
"LineW... | // GenericScatter draws the given points according to style.
// style.FillColor is used as color of error bars and style.FontSize is used
// as the length of the endmarks of the error bars. Both have suitable defaults
// if the FontXyz are not set. Point coordinates and errors must be provided
// in screen coordinates. | [
"GenericScatter",
"draws",
"the",
"given",
"points",
"according",
"to",
"style",
".",
"style",
".",
"FillColor",
"is",
"used",
"as",
"color",
"of",
"error",
"bars",
"and",
"style",
".",
"FontSize",
"is",
"used",
"as",
"the",
"length",
"of",
"the",
"endmark... | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/graphics.go#L369-L410 |
22,845 | vdobler/chart | key.go | Layout | func (key Key) Layout(bg BasicGraphics, m [][]*KeyEntry, font Font) (w, h int, colwidth, rowheight []int) {
fontwidth, fontheight, _ := bg.FontMetrics(font)
cols, rows := len(m), len(m[0])
// Find total width and height
totalh := 0
rowheight = make([]int, rows)
for r := 0; r < rows; r++ {
rh := 0
for c := 0;... | go | func (key Key) Layout(bg BasicGraphics, m [][]*KeyEntry, font Font) (w, h int, colwidth, rowheight []int) {
fontwidth, fontheight, _ := bg.FontMetrics(font)
cols, rows := len(m), len(m[0])
// Find total width and height
totalh := 0
rowheight = make([]int, rows)
for r := 0; r < rows; r++ {
rh := 0
for c := 0;... | [
"func",
"(",
"key",
"Key",
")",
"Layout",
"(",
"bg",
"BasicGraphics",
",",
"m",
"[",
"]",
"[",
"]",
"*",
"KeyEntry",
",",
"font",
"Font",
")",
"(",
"w",
",",
"h",
"int",
",",
"colwidth",
",",
"rowheight",
"[",
"]",
"int",
")",
"{",
"fontwidth",
... | // Layout determines how wide and broad the places keys in m will be rendered. | [
"Layout",
"determines",
"how",
"wide",
"and",
"broad",
"the",
"places",
"keys",
"in",
"m",
"will",
"be",
"rendered",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/key.go#L137-L212 |
22,846 | vdobler/chart | bar.go | AddData | func (c *BarChart) AddData(name string, data []Point, style Style) {
if len(c.Data) == 0 {
c.XRange.init()
c.YRange.init()
}
c.Data = append(c.Data, BarChartData{name, style, data})
for _, d := range data {
c.XRange.autoscale(d.X)
c.YRange.autoscale(d.Y)
}
if name != "" {
c.Key.Entries = append(c.Key.E... | go | func (c *BarChart) AddData(name string, data []Point, style Style) {
if len(c.Data) == 0 {
c.XRange.init()
c.YRange.init()
}
c.Data = append(c.Data, BarChartData{name, style, data})
for _, d := range data {
c.XRange.autoscale(d.X)
c.YRange.autoscale(d.Y)
}
if name != "" {
c.Key.Entries = append(c.Key.E... | [
"func",
"(",
"c",
"*",
"BarChart",
")",
"AddData",
"(",
"name",
"string",
",",
"data",
"[",
"]",
"Point",
",",
"style",
"Style",
")",
"{",
"if",
"len",
"(",
"c",
".",
"Data",
")",
"==",
"0",
"{",
"c",
".",
"XRange",
".",
"init",
"(",
")",
"\n... | // AddData adds the data to the chart. | [
"AddData",
"adds",
"the",
"data",
"to",
"the",
"chart",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/bar.go#L35-L49 |
22,847 | vdobler/chart | style.go | SymbolIndex | func SymbolIndex(s int) (idx int) {
for idx = 0; idx < len(Symbol); idx++ {
if Symbol[idx] == s {
return idx
}
}
return -1
} | go | func SymbolIndex(s int) (idx int) {
for idx = 0; idx < len(Symbol); idx++ {
if Symbol[idx] == s {
return idx
}
}
return -1
} | [
"func",
"SymbolIndex",
"(",
"s",
"int",
")",
"(",
"idx",
"int",
")",
"{",
"for",
"idx",
"=",
"0",
";",
"idx",
"<",
"len",
"(",
"Symbol",
")",
";",
"idx",
"++",
"{",
"if",
"Symbol",
"[",
"idx",
"]",
"==",
"s",
"{",
"return",
"idx",
"\n",
"}",
... | // SymbolIndex returns the index of the symbol s in Symbol or -1 if not found. | [
"SymbolIndex",
"returns",
"the",
"index",
"of",
"the",
"symbol",
"s",
"in",
"Symbol",
"or",
"-",
"1",
"if",
"not",
"found",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/style.go#L29-L36 |
22,848 | vdobler/chart | stat.go | PercentilInt | func PercentilInt(data []int, p int) int {
n := len(data)
if n == 0 {
return 0
}
if n == 1 {
return data[0]
}
pos := float64(p) * float64(n+1) / 100
fpos := math.Floor(pos)
intPos := int(fpos)
dif := pos - fpos
if intPos < 1 {
return data[0]
}
if intPos >= n {
return data[n-1]
}
lower := data[int... | go | func PercentilInt(data []int, p int) int {
n := len(data)
if n == 0 {
return 0
}
if n == 1 {
return data[0]
}
pos := float64(p) * float64(n+1) / 100
fpos := math.Floor(pos)
intPos := int(fpos)
dif := pos - fpos
if intPos < 1 {
return data[0]
}
if intPos >= n {
return data[n-1]
}
lower := data[int... | [
"func",
"PercentilInt",
"(",
"data",
"[",
"]",
"int",
",",
"p",
"int",
")",
"int",
"{",
"n",
":=",
"len",
"(",
"data",
")",
"\n",
"if",
"n",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"if",
"n",
"==",
"1",
"{",
"return",
"data",
"[",
"... | // Return p percentil of pre-sorted integer data. 0 <= p <= 100. | [
"Return",
"p",
"percentil",
"of",
"pre",
"-",
"sorted",
"integer",
"data",
".",
"0",
"<",
"=",
"p",
"<",
"=",
"100",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/stat.go#L9-L32 |
22,849 | vdobler/chart | svgg/svg.go | New | func New(sp *svg.SVG, width, height int, font string, fontsize int, background color.RGBA) *SvgGraphics {
if font == "" {
font = "Helvetica"
}
if fontsize == 0 {
fontsize = 12
}
s := SvgGraphics{svg: sp, w: width, h: height, font: font, fs: fontsize, bg: background}
return &s
} | go | func New(sp *svg.SVG, width, height int, font string, fontsize int, background color.RGBA) *SvgGraphics {
if font == "" {
font = "Helvetica"
}
if fontsize == 0 {
fontsize = 12
}
s := SvgGraphics{svg: sp, w: width, h: height, font: font, fs: fontsize, bg: background}
return &s
} | [
"func",
"New",
"(",
"sp",
"*",
"svg",
".",
"SVG",
",",
"width",
",",
"height",
"int",
",",
"font",
"string",
",",
"fontsize",
"int",
",",
"background",
"color",
".",
"RGBA",
")",
"*",
"SvgGraphics",
"{",
"if",
"font",
"==",
"\"",
"\"",
"{",
"font",... | // New creates a new SvgGraphics of dimension w x h, with a default font font of size fontsize. | [
"New",
"creates",
"a",
"new",
"SvgGraphics",
"of",
"dimension",
"w",
"x",
"h",
"with",
"a",
"default",
"font",
"font",
"of",
"size",
"fontsize",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/svgg/svg.go#L23-L32 |
22,850 | vdobler/chart | txtg/buf.go | NewTextBuf | func NewTextBuf(w, h int) (tb *TextBuf) {
tb = new(TextBuf)
tb.W, tb.H = w, h
tb.Buf = make([]rune, (w+1)*h)
for i, _ := range tb.Buf {
tb.Buf[i] = ' '
}
for i := 0; i < h; i++ {
tb.Buf[i*(w+1)+w] = '\n'
}
// tb.Buf[0], tb.Buf[(w+1)*h-1] = 'X', 'X'
return
} | go | func NewTextBuf(w, h int) (tb *TextBuf) {
tb = new(TextBuf)
tb.W, tb.H = w, h
tb.Buf = make([]rune, (w+1)*h)
for i, _ := range tb.Buf {
tb.Buf[i] = ' '
}
for i := 0; i < h; i++ {
tb.Buf[i*(w+1)+w] = '\n'
}
// tb.Buf[0], tb.Buf[(w+1)*h-1] = 'X', 'X'
return
} | [
"func",
"NewTextBuf",
"(",
"w",
",",
"h",
"int",
")",
"(",
"tb",
"*",
"TextBuf",
")",
"{",
"tb",
"=",
"new",
"(",
"TextBuf",
")",
"\n",
"tb",
".",
"W",
",",
"tb",
".",
"H",
"=",
"w",
",",
"h",
"\n",
"tb",
".",
"Buf",
"=",
"make",
"(",
"["... | // Set up a new TextBuf with width w and height h. | [
"Set",
"up",
"a",
"new",
"TextBuf",
"with",
"width",
"w",
"and",
"height",
"h",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/txtg/buf.go#L17-L29 |
22,851 | vdobler/chart | strip.go | AddData | func (sc *StripChart) AddData(name string, data []float64, style Style) {
n := len(sc.ScatterChart.Data) + 1
pd := make([]EPoint, len(data))
nan := math.NaN()
for i, d := range data {
pd[i].X = d
pd[i].Y = float64(n)
pd[i].DeltaX, pd[i].DeltaY = nan, nan
}
if style.empty() {
style = AutoStyle(len(sc.Data)... | go | func (sc *StripChart) AddData(name string, data []float64, style Style) {
n := len(sc.ScatterChart.Data) + 1
pd := make([]EPoint, len(data))
nan := math.NaN()
for i, d := range data {
pd[i].X = d
pd[i].Y = float64(n)
pd[i].DeltaX, pd[i].DeltaY = nan, nan
}
if style.empty() {
style = AutoStyle(len(sc.Data)... | [
"func",
"(",
"sc",
"*",
"StripChart",
")",
"AddData",
"(",
"name",
"string",
",",
"data",
"[",
"]",
"float64",
",",
"style",
"Style",
")",
"{",
"n",
":=",
"len",
"(",
"sc",
".",
"ScatterChart",
".",
"Data",
")",
"+",
"1",
"\n",
"pd",
":=",
"make"... | // AddData adds data to the strip chart. | [
"AddData",
"adds",
"data",
"to",
"the",
"strip",
"chart",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/strip.go#L18-L32 |
22,852 | vdobler/chart | strip.go | Plot | func (sc *StripChart) Plot(g Graphics) {
sc.ScatterChart.YRange.Label = ""
sc.ScatterChart.YRange.TicSetting.Hide = true
sc.ScatterChart.YRange.TicSetting.Delta = 1
sc.ScatterChart.YRange.MinMode.Fixed = true
sc.ScatterChart.YRange.MinMode.Value = 0.5
sc.ScatterChart.YRange.MaxMode.Fixed = true
sc.ScatterChart.Y... | go | func (sc *StripChart) Plot(g Graphics) {
sc.ScatterChart.YRange.Label = ""
sc.ScatterChart.YRange.TicSetting.Hide = true
sc.ScatterChart.YRange.TicSetting.Delta = 1
sc.ScatterChart.YRange.MinMode.Fixed = true
sc.ScatterChart.YRange.MinMode.Value = 0.5
sc.ScatterChart.YRange.MaxMode.Fixed = true
sc.ScatterChart.Y... | [
"func",
"(",
"sc",
"*",
"StripChart",
")",
"Plot",
"(",
"g",
"Graphics",
")",
"{",
"sc",
".",
"ScatterChart",
".",
"YRange",
".",
"Label",
"=",
"\"",
"\"",
"\n",
"sc",
".",
"ScatterChart",
".",
"YRange",
".",
"TicSetting",
".",
"Hide",
"=",
"true",
... | // Plot outputs the strip chart sc to g. | [
"Plot",
"outputs",
"the",
"strip",
"chart",
"sc",
"to",
"g",
"."
] | 6627804132c7c237061d1c8fd2554e3206daecb6 | https://github.com/vdobler/chart/blob/6627804132c7c237061d1c8fd2554e3206daecb6/strip.go#L52-L116 |
22,853 | TheThingsNetwork/ttn | api/health/client.go | Check | func Check(conn *grpc.ClientConn) (bool, error) {
res, err := healthpb.NewHealthClient(conn).Check(context.Background(), &healthpb.HealthCheckRequest{})
if err != nil {
return false, err
}
return res.Status == healthpb.HealthCheckResponse_SERVING, nil
} | go | func Check(conn *grpc.ClientConn) (bool, error) {
res, err := healthpb.NewHealthClient(conn).Check(context.Background(), &healthpb.HealthCheckRequest{})
if err != nil {
return false, err
}
return res.Status == healthpb.HealthCheckResponse_SERVING, nil
} | [
"func",
"Check",
"(",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"(",
"bool",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"healthpb",
".",
"NewHealthClient",
"(",
"conn",
")",
".",
"Check",
"(",
"context",
".",
"Background",
"(",
")",
",",
"... | // Check the health of a connection | [
"Check",
"the",
"health",
"of",
"a",
"connection"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/api/health/client.go#L13-L19 |
22,854 | TheThingsNetwork/ttn | core/types/parse_hex.go | ParseHEX | func ParseHEX(input string, length int) ([]byte, error) {
if input == "" {
return make([]byte, length), nil
}
pattern := regexp.MustCompile(fmt.Sprintf("^[[:xdigit:]]{%d}$", length*2))
valid := pattern.MatchString(input)
if !valid {
return nil, fmt.Errorf("Invalid input: %s is not hex", input)
}
slice, _ ... | go | func ParseHEX(input string, length int) ([]byte, error) {
if input == "" {
return make([]byte, length), nil
}
pattern := regexp.MustCompile(fmt.Sprintf("^[[:xdigit:]]{%d}$", length*2))
valid := pattern.MatchString(input)
if !valid {
return nil, fmt.Errorf("Invalid input: %s is not hex", input)
}
slice, _ ... | [
"func",
"ParseHEX",
"(",
"input",
"string",
",",
"length",
"int",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"input",
"==",
"\"",
"\"",
"{",
"return",
"make",
"(",
"[",
"]",
"byte",
",",
"length",
")",
",",
"nil",
"\n",
"}",
"\n\... | // ParseHEX parses a string "input" to a byteslice with length "length". | [
"ParseHEX",
"parses",
"a",
"string",
"input",
"to",
"a",
"byteslice",
"with",
"length",
"length",
"."
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/parse_hex.go#L13-L28 |
22,855 | TheThingsNetwork/ttn | core/router/router.go | NewRouter | func NewRouter() Router {
return &router{
gateways: make(map[string]*gateway.Gateway),
brokers: make(map[string]*broker),
}
} | go | func NewRouter() Router {
return &router{
gateways: make(map[string]*gateway.Gateway),
brokers: make(map[string]*broker),
}
} | [
"func",
"NewRouter",
"(",
")",
"Router",
"{",
"return",
"&",
"router",
"{",
"gateways",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"gateway",
".",
"Gateway",
")",
",",
"brokers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"broker",
")... | // NewRouter creates a new Router | [
"NewRouter",
"creates",
"a",
"new",
"Router"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/router/router.go#L54-L59 |
22,856 | TheThingsNetwork/ttn | core/router/router.go | getGateway | func (r *router) getGateway(id string) *gateway.Gateway {
// We're going to be optimistic and guess that the gateway is already active
r.gatewaysLock.RLock()
gtw, ok := r.gateways[id]
r.gatewaysLock.RUnlock()
if ok {
return gtw
}
// If it doesn't we still have to lock
r.gatewaysLock.Lock()
defer r.gatewaysLo... | go | func (r *router) getGateway(id string) *gateway.Gateway {
// We're going to be optimistic and guess that the gateway is already active
r.gatewaysLock.RLock()
gtw, ok := r.gateways[id]
r.gatewaysLock.RUnlock()
if ok {
return gtw
}
// If it doesn't we still have to lock
r.gatewaysLock.Lock()
defer r.gatewaysLo... | [
"func",
"(",
"r",
"*",
"router",
")",
"getGateway",
"(",
"id",
"string",
")",
"*",
"gateway",
".",
"Gateway",
"{",
"// We're going to be optimistic and guess that the gateway is already active",
"r",
".",
"gatewaysLock",
".",
"RLock",
"(",
")",
"\n",
"gtw",
",",
... | // getGateway gets or creates a Gateway | [
"getGateway",
"gets",
"or",
"creates",
"a",
"Gateway"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/router/router.go#L114-L147 |
22,857 | TheThingsNetwork/ttn | core/router/router.go | getBroker | func (r *router) getBroker(brokerAnnouncement *pb_discovery.Announcement) (*broker, error) {
// We're going to be optimistic and guess that the broker is already active
r.brokersLock.RLock()
brk, ok := r.brokers[brokerAnnouncement.ID]
r.brokersLock.RUnlock()
if ok {
return brk, nil
}
// If it doesn't we still... | go | func (r *router) getBroker(brokerAnnouncement *pb_discovery.Announcement) (*broker, error) {
// We're going to be optimistic and guess that the broker is already active
r.brokersLock.RLock()
brk, ok := r.brokers[brokerAnnouncement.ID]
r.brokersLock.RUnlock()
if ok {
return brk, nil
}
// If it doesn't we still... | [
"func",
"(",
"r",
"*",
"router",
")",
"getBroker",
"(",
"brokerAnnouncement",
"*",
"pb_discovery",
".",
"Announcement",
")",
"(",
"*",
"broker",
",",
"error",
")",
"{",
"// We're going to be optimistic and guess that the broker is already active",
"r",
".",
"brokersLo... | // getBroker gets or creates a broker association and returns the broker
// the first time it also starts a goroutine that receives downlink from the broker | [
"getBroker",
"gets",
"or",
"creates",
"a",
"broker",
"association",
"and",
"returns",
"the",
"broker",
"the",
"first",
"time",
"it",
"also",
"starts",
"a",
"goroutine",
"that",
"receives",
"downlink",
"from",
"the",
"broker"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/router/router.go#L151-L209 |
22,858 | TheThingsNetwork/ttn | mqtt/downlink.go | PublishDownlink | func (c *DefaultClient) PublishDownlink(dataDown types.DownlinkMessage) Token {
topic := DeviceTopic{dataDown.AppID, dataDown.DevID, DeviceDownlink, ""}
dataDown.AppID = ""
dataDown.DevID = ""
msg, err := json.Marshal(dataDown)
if err != nil {
return &simpleToken{fmt.Errorf("Unable to marshal the message payload... | go | func (c *DefaultClient) PublishDownlink(dataDown types.DownlinkMessage) Token {
topic := DeviceTopic{dataDown.AppID, dataDown.DevID, DeviceDownlink, ""}
dataDown.AppID = ""
dataDown.DevID = ""
msg, err := json.Marshal(dataDown)
if err != nil {
return &simpleToken{fmt.Errorf("Unable to marshal the message payload... | [
"func",
"(",
"c",
"*",
"DefaultClient",
")",
"PublishDownlink",
"(",
"dataDown",
"types",
".",
"DownlinkMessage",
")",
"Token",
"{",
"topic",
":=",
"DeviceTopic",
"{",
"dataDown",
".",
"AppID",
",",
"dataDown",
".",
"DevID",
",",
"DeviceDownlink",
",",
"\"",... | // PublishDownlink publishes a downlink message | [
"PublishDownlink",
"publishes",
"a",
"downlink",
"message"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/mqtt/downlink.go#L18-L27 |
22,859 | TheThingsNetwork/ttn | mqtt/downlink.go | UnsubscribeDeviceDownlink | func (c *DefaultClient) UnsubscribeDeviceDownlink(appID string, devID string) Token {
topic := DeviceTopic{appID, devID, DeviceDownlink, ""}
return c.unsubscribe(topic.String())
} | go | func (c *DefaultClient) UnsubscribeDeviceDownlink(appID string, devID string) Token {
topic := DeviceTopic{appID, devID, DeviceDownlink, ""}
return c.unsubscribe(topic.String())
} | [
"func",
"(",
"c",
"*",
"DefaultClient",
")",
"UnsubscribeDeviceDownlink",
"(",
"appID",
"string",
",",
"devID",
"string",
")",
"Token",
"{",
"topic",
":=",
"DeviceTopic",
"{",
"appID",
",",
"devID",
",",
"DeviceDownlink",
",",
"\"",
"\"",
"}",
"\n",
"retur... | // UnsubscribeDeviceDownlink unsubscribes from the downlink messages for the given application and device | [
"UnsubscribeDeviceDownlink",
"unsubscribes",
"from",
"the",
"downlink",
"messages",
"for",
"the",
"given",
"application",
"and",
"device"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/mqtt/downlink.go#L66-L69 |
22,860 | TheThingsNetwork/ttn | core/storage/redis_set_store.go | NewRedisSetStore | func NewRedisSetStore(client *redis.Client, prefix string) *RedisSetStore {
if !strings.HasSuffix(prefix, ":") {
prefix += ":"
}
return &RedisSetStore{
RedisStore: NewRedisStore(client, prefix),
}
} | go | func NewRedisSetStore(client *redis.Client, prefix string) *RedisSetStore {
if !strings.HasSuffix(prefix, ":") {
prefix += ":"
}
return &RedisSetStore{
RedisStore: NewRedisStore(client, prefix),
}
} | [
"func",
"NewRedisSetStore",
"(",
"client",
"*",
"redis",
".",
"Client",
",",
"prefix",
"string",
")",
"*",
"RedisSetStore",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"prefix",
",",
"\"",
"\"",
")",
"{",
"prefix",
"+=",
"\"",
"\"",
"\n",
"}",
... | // NewRedisSetStore creates a new RedisSetStore | [
"NewRedisSetStore",
"creates",
"a",
"new",
"RedisSetStore"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_set_store.go#L21-L28 |
22,861 | TheThingsNetwork/ttn | core/storage/redis_set_store.go | GetAll | func (s *RedisSetStore) GetAll(keys []string, options *ListOptions) (map[string][]string, error) {
if len(keys) == 0 {
return map[string][]string{}, nil
}
for i, key := range keys {
if !strings.HasPrefix(key, s.prefix) {
keys[i] = s.prefix + key
}
}
sort.Strings(keys)
selectedKeys := selectKeys(keys, ... | go | func (s *RedisSetStore) GetAll(keys []string, options *ListOptions) (map[string][]string, error) {
if len(keys) == 0 {
return map[string][]string{}, nil
}
for i, key := range keys {
if !strings.HasPrefix(key, s.prefix) {
keys[i] = s.prefix + key
}
}
sort.Strings(keys)
selectedKeys := selectKeys(keys, ... | [
"func",
"(",
"s",
"*",
"RedisSetStore",
")",
"GetAll",
"(",
"keys",
"[",
"]",
"string",
",",
"options",
"*",
"ListOptions",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"len",
"(",
"keys",
")",
"==",
"0",... | // GetAll returns all results for the given keys, prepending the prefix to the keys if necessary | [
"GetAll",
"returns",
"all",
"results",
"for",
"the",
"given",
"keys",
"prepending",
"the",
"prefix",
"to",
"the",
"keys",
"if",
"necessary"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_set_store.go#L31-L75 |
22,862 | TheThingsNetwork/ttn | core/storage/redis_set_store.go | Count | func (s *RedisSetStore) Count(key string) (int, error) {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
res, err := s.client.SCard(key).Result()
return int(res), err
} | go | func (s *RedisSetStore) Count(key string) (int, error) {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
res, err := s.client.SCard(key).Result()
return int(res), err
} | [
"func",
"(",
"s",
"*",
"RedisSetStore",
")",
"Count",
"(",
"key",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"s",
".",
"prefix",
")",
"{",
"key",
"=",
"s",
".",
"prefix",
"+",
"ke... | // Count the number of items for the given key | [
"Count",
"the",
"number",
"of",
"items",
"for",
"the",
"given",
"key"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_set_store.go#L78-L84 |
22,863 | TheThingsNetwork/ttn | core/storage/redis_set_store.go | Contains | func (s *RedisSetStore) Contains(key string, value string) (res bool, err error) {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
res, err = s.client.SIsMember(key, value).Result()
if err == redis.Nil {
return res, errors.NewErrNotFound(key)
}
return res, err
} | go | func (s *RedisSetStore) Contains(key string, value string) (res bool, err error) {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
res, err = s.client.SIsMember(key, value).Result()
if err == redis.Nil {
return res, errors.NewErrNotFound(key)
}
return res, err
} | [
"func",
"(",
"s",
"*",
"RedisSetStore",
")",
"Contains",
"(",
"key",
"string",
",",
"value",
"string",
")",
"(",
"res",
"bool",
",",
"err",
"error",
")",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"s",
".",
"prefix",
")",
"{",
... | // Contains returns wheter the set contains a given value, prepending the prefix to the key if necessary | [
"Contains",
"returns",
"wheter",
"the",
"set",
"contains",
"a",
"given",
"value",
"prepending",
"the",
"prefix",
"to",
"the",
"key",
"if",
"necessary"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_set_store.go#L109-L118 |
22,864 | TheThingsNetwork/ttn | core/storage/redis_set_store.go | Add | func (s *RedisSetStore) Add(key string, values ...string) error {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
valuesI := make([]interface{}, len(values))
for i, v := range values {
valuesI[i] = v
}
return s.client.SAdd(key, valuesI...).Err()
} | go | func (s *RedisSetStore) Add(key string, values ...string) error {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
valuesI := make([]interface{}, len(values))
for i, v := range values {
valuesI[i] = v
}
return s.client.SAdd(key, valuesI...).Err()
} | [
"func",
"(",
"s",
"*",
"RedisSetStore",
")",
"Add",
"(",
"key",
"string",
",",
"values",
"...",
"string",
")",
"error",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"s",
".",
"prefix",
")",
"{",
"key",
"=",
"s",
".",
"prefix",
"+... | // Add one or more values to the set, prepending the prefix to the key if necessary | [
"Add",
"one",
"or",
"more",
"values",
"to",
"the",
"set",
"prepending",
"the",
"prefix",
"to",
"the",
"key",
"if",
"necessary"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_set_store.go#L121-L130 |
22,865 | TheThingsNetwork/ttn | core/storage/redis_map_migrate.go | AddMigration | func (s *RedisMapStore) AddMigration(version string, migrate MigrateFunction) {
s.migrations[version] = migrate
} | go | func (s *RedisMapStore) AddMigration(version string, migrate MigrateFunction) {
s.migrations[version] = migrate
} | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"AddMigration",
"(",
"version",
"string",
",",
"migrate",
"MigrateFunction",
")",
"{",
"s",
".",
"migrations",
"[",
"version",
"]",
"=",
"migrate",
"\n",
"}"
] | // AddMigration adds a data migration for a version | [
"AddMigration",
"adds",
"a",
"data",
"migration",
"for",
"a",
"version"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_migrate.go#L25-L27 |
22,866 | TheThingsNetwork/ttn | core/storage/redis_map_migrate.go | Migrate | func (s *RedisMapStore) Migrate(selector string) error {
if selector == "" {
selector = "*"
}
if !strings.HasPrefix(selector, s.prefix) {
selector = s.prefix + selector
}
var cursor uint64
for {
keys, next, err := s.client.Scan(cursor, selector, 0).Result()
if err != nil {
return err
}
for _, key... | go | func (s *RedisMapStore) Migrate(selector string) error {
if selector == "" {
selector = "*"
}
if !strings.HasPrefix(selector, s.prefix) {
selector = s.prefix + selector
}
var cursor uint64
for {
keys, next, err := s.client.Scan(cursor, selector, 0).Result()
if err != nil {
return err
}
for _, key... | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"Migrate",
"(",
"selector",
"string",
")",
"error",
"{",
"if",
"selector",
"==",
"\"",
"\"",
"{",
"selector",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"selector",
",",... | // Migrate all documents matching the selector | [
"Migrate",
"all",
"documents",
"matching",
"the",
"selector"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_migrate.go#L30-L74 |
22,867 | TheThingsNetwork/ttn | core/storage/util.go | GetTotalAndSelected | func (o ListOptions) GetTotalAndSelected() (total, selected uint64) {
return o.total, o.selected
} | go | func (o ListOptions) GetTotalAndSelected() (total, selected uint64) {
return o.total, o.selected
} | [
"func",
"(",
"o",
"ListOptions",
")",
"GetTotalAndSelected",
"(",
")",
"(",
"total",
",",
"selected",
"uint64",
")",
"{",
"return",
"o",
".",
"total",
",",
"o",
".",
"selected",
"\n",
"}"
] | // GetTotalAndSelected returns the total number of items, along with the number of selected items | [
"GetTotalAndSelected",
"returns",
"the",
"total",
"number",
"of",
"items",
"along",
"with",
"the",
"number",
"of",
"selected",
"items"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/util.go#L21-L23 |
22,868 | TheThingsNetwork/ttn | core/storage/util.go | UseCache | func (o *ListOptions) UseCache(key string, ttl time.Duration) {
o.cacheKey, o.cacheTTL = key, ttl
} | go | func (o *ListOptions) UseCache(key string, ttl time.Duration) {
o.cacheKey, o.cacheTTL = key, ttl
} | [
"func",
"(",
"o",
"*",
"ListOptions",
")",
"UseCache",
"(",
"key",
"string",
",",
"ttl",
"time",
".",
"Duration",
")",
"{",
"o",
".",
"cacheKey",
",",
"o",
".",
"cacheTTL",
"=",
"key",
",",
"ttl",
"\n",
"}"
] | // UseCache instructs the list operation to use a result cache. | [
"UseCache",
"instructs",
"the",
"list",
"operation",
"to",
"use",
"a",
"result",
"cache",
"."
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/util.go#L26-L28 |
22,869 | TheThingsNetwork/ttn | core/proxy/proxy.go | WithLogger | func WithLogger(handler http.Handler, ctx ttnlog.Interface) http.Handler {
return &logProxier{ctx, handler}
} | go | func WithLogger(handler http.Handler, ctx ttnlog.Interface) http.Handler {
return &logProxier{ctx, handler}
} | [
"func",
"WithLogger",
"(",
"handler",
"http",
".",
"Handler",
",",
"ctx",
"ttnlog",
".",
"Interface",
")",
"http",
".",
"Handler",
"{",
"return",
"&",
"logProxier",
"{",
"ctx",
",",
"handler",
"}",
"\n",
"}"
] | // WithLogger wraps the handler so that each request gets logged | [
"WithLogger",
"wraps",
"the",
"handler",
"so",
"that",
"each",
"request",
"gets",
"logged"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/proxy/proxy.go#L50-L52 |
22,870 | TheThingsNetwork/ttn | core/networkserver/device/frames.go | Push | func (s *RedisFrameHistory) Push(frame *Frame) error {
frameBytes, err := json.Marshal(frame)
if err != nil {
return err
}
if err := s.store.AddFront(s.key(), string(frameBytes)); err != nil {
return err
}
return s.Trim()
} | go | func (s *RedisFrameHistory) Push(frame *Frame) error {
frameBytes, err := json.Marshal(frame)
if err != nil {
return err
}
if err := s.store.AddFront(s.key(), string(frameBytes)); err != nil {
return err
}
return s.Trim()
} | [
"func",
"(",
"s",
"*",
"RedisFrameHistory",
")",
"Push",
"(",
"frame",
"*",
"Frame",
")",
"error",
"{",
"frameBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"frame",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n"... | // Push a Frame to the device's history | [
"Push",
"a",
"Frame",
"to",
"the",
"device",
"s",
"history"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/networkserver/device/frames.go#L43-L52 |
22,871 | TheThingsNetwork/ttn | core/networkserver/device/frames.go | Get | func (s *RedisFrameHistory) Get() (out []*Frame, err error) {
frames, err := s.store.GetFront(s.key(), FramesHistorySize)
for _, frameStr := range frames {
frame := new(Frame)
if err := json.Unmarshal([]byte(frameStr), frame); err != nil {
return nil, err
}
out = append(out, frame)
}
return
} | go | func (s *RedisFrameHistory) Get() (out []*Frame, err error) {
frames, err := s.store.GetFront(s.key(), FramesHistorySize)
for _, frameStr := range frames {
frame := new(Frame)
if err := json.Unmarshal([]byte(frameStr), frame); err != nil {
return nil, err
}
out = append(out, frame)
}
return
} | [
"func",
"(",
"s",
"*",
"RedisFrameHistory",
")",
"Get",
"(",
")",
"(",
"out",
"[",
"]",
"*",
"Frame",
",",
"err",
"error",
")",
"{",
"frames",
",",
"err",
":=",
"s",
".",
"store",
".",
"GetFront",
"(",
"s",
".",
"key",
"(",
")",
",",
"FramesHis... | // Get the last frames from the device's history | [
"Get",
"the",
"last",
"frames",
"from",
"the",
"device",
"s",
"history"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/networkserver/device/frames.go#L55-L65 |
22,872 | TheThingsNetwork/ttn | core/networkserver/device/frames.go | Trim | func (s *RedisFrameHistory) Trim() error {
return s.store.Trim(s.key(), FramesHistorySize)
} | go | func (s *RedisFrameHistory) Trim() error {
return s.store.Trim(s.key(), FramesHistorySize)
} | [
"func",
"(",
"s",
"*",
"RedisFrameHistory",
")",
"Trim",
"(",
")",
"error",
"{",
"return",
"s",
".",
"store",
".",
"Trim",
"(",
"s",
".",
"key",
"(",
")",
",",
"FramesHistorySize",
")",
"\n",
"}"
] | // Trim frames in the device's history | [
"Trim",
"frames",
"in",
"the",
"device",
"s",
"history"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/networkserver/device/frames.go#L68-L70 |
22,873 | TheThingsNetwork/ttn | core/handler/manager_server.go | eventUpdatedFields | func eventUpdatedFields(dev *device.Device) types.DeviceEventData {
changeList := dev.ChangedFields()
e := types.DeviceEventData{}
for _, key := range changeList {
switch key {
case "Latitude":
e.Latitude = dev.Latitude
case "Longitude":
e.Longitude = dev.Longitude
case "Altitude":
e.Altitude = dev.... | go | func eventUpdatedFields(dev *device.Device) types.DeviceEventData {
changeList := dev.ChangedFields()
e := types.DeviceEventData{}
for _, key := range changeList {
switch key {
case "Latitude":
e.Latitude = dev.Latitude
case "Longitude":
e.Longitude = dev.Longitude
case "Altitude":
e.Altitude = dev.... | [
"func",
"eventUpdatedFields",
"(",
"dev",
"*",
"device",
".",
"Device",
")",
"types",
".",
"DeviceEventData",
"{",
"changeList",
":=",
"dev",
".",
"ChangedFields",
"(",
")",
"\n",
"e",
":=",
"types",
".",
"DeviceEventData",
"{",
"}",
"\n",
"for",
"_",
",... | // eventUpdatedFields create DeviceEvent based of on the changelist of a device | [
"eventUpdatedFields",
"create",
"DeviceEvent",
"based",
"of",
"on",
"the",
"changelist",
"of",
"a",
"device"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/handler/manager_server.go#L240-L256 |
22,874 | TheThingsNetwork/ttn | core/handler/application/migrate/application.go | ApplicationMigrations | func ApplicationMigrations(prefix string) map[string]storage.MigrateFunction {
funcs := make(map[string]storage.MigrateFunction)
for v, f := range applicationMigrations {
funcs[v] = f(prefix)
}
return funcs
} | go | func ApplicationMigrations(prefix string) map[string]storage.MigrateFunction {
funcs := make(map[string]storage.MigrateFunction)
for v, f := range applicationMigrations {
funcs[v] = f(prefix)
}
return funcs
} | [
"func",
"ApplicationMigrations",
"(",
"prefix",
"string",
")",
"map",
"[",
"string",
"]",
"storage",
".",
"MigrateFunction",
"{",
"funcs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"storage",
".",
"MigrateFunction",
")",
"\n",
"for",
"v",
",",
"f",
"... | // ApplicationMigrations filled with the prefix | [
"ApplicationMigrations",
"filled",
"with",
"the",
"prefix"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/handler/application/migrate/application.go#L13-L19 |
22,875 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedDevAddr | func NewPopulatedDevAddr(r Rand) (devAddr *DevAddr) {
devAddr = &DevAddr{}
if _, err := randRead(r, devAddr[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedDevAddr: %s", err))
}
return
} | go | func NewPopulatedDevAddr(r Rand) (devAddr *DevAddr) {
devAddr = &DevAddr{}
if _, err := randRead(r, devAddr[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedDevAddr: %s", err))
}
return
} | [
"func",
"NewPopulatedDevAddr",
"(",
"r",
"Rand",
")",
"(",
"devAddr",
"*",
"DevAddr",
")",
"{",
"devAddr",
"=",
"&",
"DevAddr",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"devAddr",
"[",
":",
"]",
")",
";",
"err",
"!=... | // NewPopulatedDevAddr returns random DevAddr | [
"NewPopulatedDevAddr",
"returns",
"random",
"DevAddr"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L32-L38 |
22,876 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedAppEUI | func NewPopulatedAppEUI(r Rand) (appEUI *AppEUI) {
appEUI = &AppEUI{}
if _, err := randRead(r, appEUI[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppEUI: %s", err))
}
return
} | go | func NewPopulatedAppEUI(r Rand) (appEUI *AppEUI) {
appEUI = &AppEUI{}
if _, err := randRead(r, appEUI[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppEUI: %s", err))
}
return
} | [
"func",
"NewPopulatedAppEUI",
"(",
"r",
"Rand",
")",
"(",
"appEUI",
"*",
"AppEUI",
")",
"{",
"appEUI",
"=",
"&",
"AppEUI",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"appEUI",
"[",
":",
"]",
")",
";",
"err",
"!=",
"... | // NewPopulatedAppEUI returns random AppEUI | [
"NewPopulatedAppEUI",
"returns",
"random",
"AppEUI"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L41-L47 |
22,877 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedDevEUI | func NewPopulatedDevEUI(r Rand) (devEUI *DevEUI) {
devEUI = &DevEUI{}
if _, err := randRead(r, devEUI[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedDevEUI: %s", err))
}
return
} | go | func NewPopulatedDevEUI(r Rand) (devEUI *DevEUI) {
devEUI = &DevEUI{}
if _, err := randRead(r, devEUI[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedDevEUI: %s", err))
}
return
} | [
"func",
"NewPopulatedDevEUI",
"(",
"r",
"Rand",
")",
"(",
"devEUI",
"*",
"DevEUI",
")",
"{",
"devEUI",
"=",
"&",
"DevEUI",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"devEUI",
"[",
":",
"]",
")",
";",
"err",
"!=",
"... | // NewPopulatedDevEUI returns random DevEUI | [
"NewPopulatedDevEUI",
"returns",
"random",
"DevEUI"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L50-L56 |
22,878 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedAppKey | func NewPopulatedAppKey(r Rand) (key *AppKey) {
key = &AppKey{}
if _, err := randRead(r, key[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppKey: %s", err))
}
return
} | go | func NewPopulatedAppKey(r Rand) (key *AppKey) {
key = &AppKey{}
if _, err := randRead(r, key[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppKey: %s", err))
}
return
} | [
"func",
"NewPopulatedAppKey",
"(",
"r",
"Rand",
")",
"(",
"key",
"*",
"AppKey",
")",
"{",
"key",
"=",
"&",
"AppKey",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"key",
"[",
":",
"]",
")",
";",
"err",
"!=",
"nil",
"... | // NewPopulatedAppKey returns random AppKey | [
"NewPopulatedAppKey",
"returns",
"random",
"AppKey"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L59-L65 |
22,879 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedAppSKey | func NewPopulatedAppSKey(r Rand) (key *AppSKey) {
key = &AppSKey{}
if _, err := randRead(r, key[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppSKey: %s", err))
}
return
} | go | func NewPopulatedAppSKey(r Rand) (key *AppSKey) {
key = &AppSKey{}
if _, err := randRead(r, key[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppSKey: %s", err))
}
return
} | [
"func",
"NewPopulatedAppSKey",
"(",
"r",
"Rand",
")",
"(",
"key",
"*",
"AppSKey",
")",
"{",
"key",
"=",
"&",
"AppSKey",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"key",
"[",
":",
"]",
")",
";",
"err",
"!=",
"nil",
... | // NewPopulatedAppSKey returns random AppSKey | [
"NewPopulatedAppSKey",
"returns",
"random",
"AppSKey"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L68-L74 |
22,880 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedNwkSKey | func NewPopulatedNwkSKey(r Rand) (key *NwkSKey) {
key = &NwkSKey{}
if _, err := randRead(r, key[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedNwkSKey: %s", err))
}
return
} | go | func NewPopulatedNwkSKey(r Rand) (key *NwkSKey) {
key = &NwkSKey{}
if _, err := randRead(r, key[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedNwkSKey: %s", err))
}
return
} | [
"func",
"NewPopulatedNwkSKey",
"(",
"r",
"Rand",
")",
"(",
"key",
"*",
"NwkSKey",
")",
"{",
"key",
"=",
"&",
"NwkSKey",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"key",
"[",
":",
"]",
")",
";",
"err",
"!=",
"nil",
... | // NewPopulatedNwkSKey returns random NwkSKey | [
"NewPopulatedNwkSKey",
"returns",
"random",
"NwkSKey"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L77-L83 |
22,881 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedDevNonce | func NewPopulatedDevNonce(r Rand) (nonce *DevNonce) {
nonce = &DevNonce{}
if _, err := randRead(r, nonce[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedDevNonce: %s", err))
}
return
} | go | func NewPopulatedDevNonce(r Rand) (nonce *DevNonce) {
nonce = &DevNonce{}
if _, err := randRead(r, nonce[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedDevNonce: %s", err))
}
return
} | [
"func",
"NewPopulatedDevNonce",
"(",
"r",
"Rand",
")",
"(",
"nonce",
"*",
"DevNonce",
")",
"{",
"nonce",
"=",
"&",
"DevNonce",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"nonce",
"[",
":",
"]",
")",
";",
"err",
"!=",
... | // NewPopulatedDevNonce returns random DevNonce | [
"NewPopulatedDevNonce",
"returns",
"random",
"DevNonce"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L86-L92 |
22,882 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedAppNonce | func NewPopulatedAppNonce(r Rand) (nonce *AppNonce) {
nonce = &AppNonce{}
if _, err := randRead(r, nonce[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppNonce: %s", err))
}
return
} | go | func NewPopulatedAppNonce(r Rand) (nonce *AppNonce) {
nonce = &AppNonce{}
if _, err := randRead(r, nonce[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedAppNonce: %s", err))
}
return
} | [
"func",
"NewPopulatedAppNonce",
"(",
"r",
"Rand",
")",
"(",
"nonce",
"*",
"AppNonce",
")",
"{",
"nonce",
"=",
"&",
"AppNonce",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"nonce",
"[",
":",
"]",
")",
";",
"err",
"!=",
... | // NewPopulatedAppNonce returns random AppNonce | [
"NewPopulatedAppNonce",
"returns",
"random",
"AppNonce"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L95-L101 |
22,883 | TheThingsNetwork/ttn | core/types/random.go | NewPopulatedNetID | func NewPopulatedNetID(r Rand) (id *NetID) {
id = &NetID{}
if _, err := randRead(r, id[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedNetID: %s", err))
}
return
} | go | func NewPopulatedNetID(r Rand) (id *NetID) {
id = &NetID{}
if _, err := randRead(r, id[:]); err != nil {
panic(fmt.Errorf("types.NewPopulatedNetID: %s", err))
}
return
} | [
"func",
"NewPopulatedNetID",
"(",
"r",
"Rand",
")",
"(",
"id",
"*",
"NetID",
")",
"{",
"id",
"=",
"&",
"NetID",
"{",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"randRead",
"(",
"r",
",",
"id",
"[",
":",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
... | // NewPopulatedNetID returns random NetID | [
"NewPopulatedNetID",
"returns",
"random",
"NetID"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/random.go#L104-L110 |
22,884 | TheThingsNetwork/ttn | core/router/gateway/utilization.go | NewUtilization | func NewUtilization() Utilization {
return &utilization{
overallRx: metrics.NewEWMA1(),
channelRx: map[uint64]metrics.EWMA{},
overallTx: metrics.NewEWMA1(),
channelTx: map[uint64]metrics.EWMA{},
}
} | go | func NewUtilization() Utilization {
return &utilization{
overallRx: metrics.NewEWMA1(),
channelRx: map[uint64]metrics.EWMA{},
overallTx: metrics.NewEWMA1(),
channelTx: map[uint64]metrics.EWMA{},
}
} | [
"func",
"NewUtilization",
"(",
")",
"Utilization",
"{",
"return",
"&",
"utilization",
"{",
"overallRx",
":",
"metrics",
".",
"NewEWMA1",
"(",
")",
",",
"channelRx",
":",
"map",
"[",
"uint64",
"]",
"metrics",
".",
"EWMA",
"{",
"}",
",",
"overallTx",
":",
... | // NewUtilization creates a new Utilization | [
"NewUtilization",
"creates",
"a",
"new",
"Utilization"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/router/gateway/utilization.go#L34-L41 |
22,885 | TheThingsNetwork/ttn | core/handler/device/migrate/2_4_1_downlink_queue.go | DownlinkQueue | func DownlinkQueue(prefix string) storage.MigrateFunction {
return func(client *redis.Client, key string, obj map[string]string) (string, map[string]string, error) {
var err error
nextDownlink, ok := obj["next_downlink"]
if ok {
delete(obj, "next_downlink")
scheduleKey := prefix + ":downlink" + strings.Tri... | go | func DownlinkQueue(prefix string) storage.MigrateFunction {
return func(client *redis.Client, key string, obj map[string]string) (string, map[string]string, error) {
var err error
nextDownlink, ok := obj["next_downlink"]
if ok {
delete(obj, "next_downlink")
scheduleKey := prefix + ":downlink" + strings.Tri... | [
"func",
"DownlinkQueue",
"(",
"prefix",
"string",
")",
"storage",
".",
"MigrateFunction",
"{",
"return",
"func",
"(",
"client",
"*",
"redis",
".",
"Client",
",",
"key",
"string",
",",
"obj",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"string",
",",
... | // DownlinkQueue migration from 2.4.1 to 2.5.0 | [
"DownlinkQueue",
"migration",
"from",
"2",
".",
"4",
".",
"1",
"to",
"2",
".",
"5",
".",
"0"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/handler/device/migrate/2_4_1_downlink_queue.go#L14-L25 |
22,886 | TheThingsNetwork/ttn | ttnctl/cmd/root.go | init | func init() {
cobra.OnInitialize(initConfig)
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.ttnctl.yml)")
RootCmd.PersistentFlags().StringVar(&dataDir, "data", "", "directory where ttnctl stores data (default is $HOME/.ttnctl)")
RootCmd.PersistentFlags().String("discove... | go | func init() {
cobra.OnInitialize(initConfig)
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.ttnctl.yml)")
RootCmd.PersistentFlags().StringVar(&dataDir, "data", "", "directory where ttnctl stores data (default is $HOME/.ttnctl)")
RootCmd.PersistentFlags().String("discove... | [
"func",
"init",
"(",
")",
"{",
"cobra",
".",
"OnInitialize",
"(",
"initConfig",
")",
"\n\n",
"RootCmd",
".",
"PersistentFlags",
"(",
")",
".",
"StringVar",
"(",
"&",
"cfgFile",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"RootCmd",
... | // init initializes the configuration and command line flags | [
"init",
"initializes",
"the",
"configuration",
"and",
"command",
"line",
"flags"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/ttnctl/cmd/root.go#L68-L86 |
22,887 | TheThingsNetwork/ttn | utils/elasticsearch/handler/elasticsearch.go | indexName | func (h *Handler) indexName() string {
return fmt.Sprintf("%s-%s", h.Config.Prefix, time.Now().Format("2006.01.02"))
} | go | func (h *Handler) indexName() string {
return fmt.Sprintf("%s-%s", h.Config.Prefix, time.Now().Format("2006.01.02"))
} | [
"func",
"(",
"h",
"*",
"Handler",
")",
"indexName",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"h",
".",
"Config",
".",
"Prefix",
",",
"time",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"\"",
"\"",
")",
")",
... | // indexName returns the index for the configured | [
"indexName",
"returns",
"the",
"index",
"for",
"the",
"configured"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/utils/elasticsearch/handler/elasticsearch.go#L54-L56 |
22,888 | TheThingsNetwork/ttn | core/types/keys.go | ParseAES128Key | func ParseAES128Key(input string) (key AES128Key, err error) {
bytes, err := ParseHEX(input, 16)
if err != nil {
return
}
copy(key[:], bytes)
return
} | go | func ParseAES128Key(input string) (key AES128Key, err error) {
bytes, err := ParseHEX(input, 16)
if err != nil {
return
}
copy(key[:], bytes)
return
} | [
"func",
"ParseAES128Key",
"(",
"input",
"string",
")",
"(",
"key",
"AES128Key",
",",
"err",
"error",
")",
"{",
"bytes",
",",
"err",
":=",
"ParseHEX",
"(",
"input",
",",
"16",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"cop... | // ParseAES128Key parses a 128-bit hex-encoded string to an AES128Key | [
"ParseAES128Key",
"parses",
"a",
"128",
"-",
"bit",
"hex",
"-",
"encoded",
"string",
"to",
"an",
"AES128Key"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/keys.go#L26-L33 |
22,889 | TheThingsNetwork/ttn | core/types/keys.go | ParseAppKey | func ParseAppKey(input string) (key AppKey, err error) {
aes128key, err := ParseAES128Key(input)
if err != nil {
return
}
key = AppKey(aes128key)
return
} | go | func ParseAppKey(input string) (key AppKey, err error) {
aes128key, err := ParseAES128Key(input)
if err != nil {
return
}
key = AppKey(aes128key)
return
} | [
"func",
"ParseAppKey",
"(",
"input",
"string",
")",
"(",
"key",
"AppKey",
",",
"err",
"error",
")",
"{",
"aes128key",
",",
"err",
":=",
"ParseAES128Key",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"key",
"=",
... | // ParseAppKey parses a 64-bit hex-encoded string to an AppKey | [
"ParseAppKey",
"parses",
"a",
"64",
"-",
"bit",
"hex",
"-",
"encoded",
"string",
"to",
"an",
"AppKey"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/keys.go#L110-L117 |
22,890 | TheThingsNetwork/ttn | core/types/keys.go | ParseAppSKey | func ParseAppSKey(input string) (key AppSKey, err error) {
aes128key, err := ParseAES128Key(input)
if err != nil {
return
}
key = AppSKey(aes128key)
return
} | go | func ParseAppSKey(input string) (key AppSKey, err error) {
aes128key, err := ParseAES128Key(input)
if err != nil {
return
}
key = AppSKey(aes128key)
return
} | [
"func",
"ParseAppSKey",
"(",
"input",
"string",
")",
"(",
"key",
"AppSKey",
",",
"err",
"error",
")",
"{",
"aes128key",
",",
"err",
":=",
"ParseAES128Key",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"key",
"=",... | // ParseAppSKey parses a 64-bit hex-encoded string to an AppSKey | [
"ParseAppSKey",
"parses",
"a",
"64",
"-",
"bit",
"hex",
"-",
"encoded",
"string",
"to",
"an",
"AppSKey"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/keys.go#L193-L200 |
22,891 | TheThingsNetwork/ttn | core/types/keys.go | ParseNwkSKey | func ParseNwkSKey(input string) (key NwkSKey, err error) {
aes128key, err := ParseAES128Key(input)
if err != nil {
return
}
key = NwkSKey(aes128key)
return
} | go | func ParseNwkSKey(input string) (key NwkSKey, err error) {
aes128key, err := ParseAES128Key(input)
if err != nil {
return
}
key = NwkSKey(aes128key)
return
} | [
"func",
"ParseNwkSKey",
"(",
"input",
"string",
")",
"(",
"key",
"NwkSKey",
",",
"err",
"error",
")",
"{",
"aes128key",
",",
"err",
":=",
"ParseAES128Key",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"key",
"=",... | // ParseNwkSKey parses a 64-bit hex-encoded string to an NwkSKey | [
"ParseNwkSKey",
"parses",
"a",
"64",
"-",
"bit",
"hex",
"-",
"encoded",
"string",
"to",
"an",
"NwkSKey"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/types/keys.go#L276-L283 |
22,892 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | NewRedisMapStore | func NewRedisMapStore(client *redis.Client, prefix string) *RedisMapStore {
if !strings.HasSuffix(prefix, ":") {
prefix += ":"
}
return &RedisMapStore{
RedisStore: NewRedisStore(client, prefix),
migrations: make(map[string]MigrateFunction),
}
} | go | func NewRedisMapStore(client *redis.Client, prefix string) *RedisMapStore {
if !strings.HasSuffix(prefix, ":") {
prefix += ":"
}
return &RedisMapStore{
RedisStore: NewRedisStore(client, prefix),
migrations: make(map[string]MigrateFunction),
}
} | [
"func",
"NewRedisMapStore",
"(",
"client",
"*",
"redis",
".",
"Client",
",",
"prefix",
"string",
")",
"*",
"RedisMapStore",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"prefix",
",",
"\"",
"\"",
")",
"{",
"prefix",
"+=",
"\"",
"\"",
"\n",
"}",
... | // NewRedisMapStore returns a new RedisMapStore that talks to the given Redis client and respects the given prefix | [
"NewRedisMapStore",
"returns",
"a",
"new",
"RedisMapStore",
"that",
"talks",
"to",
"the",
"given",
"Redis",
"client",
"and",
"respects",
"the",
"given",
"prefix"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L24-L32 |
22,893 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | SetBase | func (s *RedisMapStore) SetBase(base interface{}, tagName string) {
if tagName == "" {
tagName = "redis"
}
s.SetEncoder(func(input interface{}, properties ...string) (map[string]string, error) {
return encoding.ToStringStringMap(tagName, input, properties...)
})
s.SetDecoder(func(input map[string]string) (outp... | go | func (s *RedisMapStore) SetBase(base interface{}, tagName string) {
if tagName == "" {
tagName = "redis"
}
s.SetEncoder(func(input interface{}, properties ...string) (map[string]string, error) {
return encoding.ToStringStringMap(tagName, input, properties...)
})
s.SetDecoder(func(input map[string]string) (outp... | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"SetBase",
"(",
"base",
"interface",
"{",
"}",
",",
"tagName",
"string",
")",
"{",
"if",
"tagName",
"==",
"\"",
"\"",
"{",
"tagName",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"s",
".",
"SetEncoder",
"(",
"func"... | // SetBase sets the base struct for automatically encoding and decoding to and from Redis format | [
"SetBase",
"sets",
"the",
"base",
"struct",
"for",
"automatically",
"encoding",
"and",
"decoding",
"to",
"and",
"from",
"Redis",
"format"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L35-L45 |
22,894 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | SetEncoder | func (s *RedisMapStore) SetEncoder(encoder func(input interface{}, properties ...string) (map[string]string, error)) {
s.encoder = encoder
} | go | func (s *RedisMapStore) SetEncoder(encoder func(input interface{}, properties ...string) (map[string]string, error)) {
s.encoder = encoder
} | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"SetEncoder",
"(",
"encoder",
"func",
"(",
"input",
"interface",
"{",
"}",
",",
"properties",
"...",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
")",
"{",
"s",
".",
"encoder... | // SetEncoder sets the encoder to convert structs to Redis format | [
"SetEncoder",
"sets",
"the",
"encoder",
"to",
"convert",
"structs",
"to",
"Redis",
"format"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L48-L50 |
22,895 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | SetDecoder | func (s *RedisMapStore) SetDecoder(decoder func(input map[string]string) (output interface{}, err error)) {
s.decoder = decoder
} | go | func (s *RedisMapStore) SetDecoder(decoder func(input map[string]string) (output interface{}, err error)) {
s.decoder = decoder
} | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"SetDecoder",
"(",
"decoder",
"func",
"(",
"input",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"output",
"interface",
"{",
"}",
",",
"err",
"error",
")",
")",
"{",
"s",
".",
"decoder",
"=",
"decoder",
... | // SetDecoder sets the decoder to convert structs from Redis format | [
"SetDecoder",
"sets",
"the",
"decoder",
"to",
"convert",
"structs",
"from",
"Redis",
"format"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L53-L55 |
22,896 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | GetAll | func (s *RedisMapStore) GetAll(keys []string, options *ListOptions) ([]interface{}, error) {
if len(keys) == 0 {
return []interface{}{}, nil
}
for i, key := range keys {
if !strings.HasPrefix(key, s.prefix) {
keys[i] = s.prefix + key
}
}
sort.Strings(keys)
selectedKeys := selectKeys(keys, options)
if... | go | func (s *RedisMapStore) GetAll(keys []string, options *ListOptions) ([]interface{}, error) {
if len(keys) == 0 {
return []interface{}{}, nil
}
for i, key := range keys {
if !strings.HasPrefix(key, s.prefix) {
keys[i] = s.prefix + key
}
}
sort.Strings(keys)
selectedKeys := selectKeys(keys, options)
if... | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"GetAll",
"(",
"keys",
"[",
"]",
"string",
",",
"options",
"*",
"ListOptions",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"len",
"(",
"keys",
")",
"==",
"0",
"{",
"return"... | // GetAll returns all results for the given keys, prepending the prefix to the keys if necessary
// This function will migrate outdated results to newer versions if migrations are set | [
"GetAll",
"returns",
"all",
"results",
"for",
"the",
"given",
"keys",
"prepending",
"the",
"prefix",
"to",
"the",
"keys",
"if",
"necessary",
"This",
"function",
"will",
"migrate",
"outdated",
"results",
"to",
"newer",
"versions",
"if",
"migrations",
"are",
"se... | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L59-L104 |
22,897 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | Get | func (s *RedisMapStore) Get(key string) (interface{}, error) {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
result, err := s.client.HGetAll(key).Result()
if err == redis.Nil || len(result) == 0 {
return nil, errors.NewErrNotFound(key)
}
if err != nil {
return nil, err
}
result, _ = s.migr... | go | func (s *RedisMapStore) Get(key string) (interface{}, error) {
if !strings.HasPrefix(key, s.prefix) {
key = s.prefix + key
}
result, err := s.client.HGetAll(key).Result()
if err == redis.Nil || len(result) == 0 {
return nil, errors.NewErrNotFound(key)
}
if err != nil {
return nil, err
}
result, _ = s.migr... | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"Get",
"(",
"key",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"s",
".",
"prefix",
")",
"{",
"key",
"=",
"s",
".",
"pre... | // Get one result, prepending the prefix to the key if necessary
// This function will migrate outdated results to newer versions if migrations are set | [
"Get",
"one",
"result",
"prepending",
"the",
"prefix",
"to",
"the",
"key",
"if",
"necessary",
"This",
"function",
"will",
"migrate",
"outdated",
"results",
"to",
"newer",
"versions",
"if",
"migrations",
"are",
"set"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L117-L134 |
22,898 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | Set | func (s *RedisMapStore) Set(key string, value interface{}, properties ...string) error {
key, vmap, err := s.prepare(key, value, properties...)
if err != nil {
return err
}
if len(vmap) == 0 {
return nil
}
return s.client.HMSet(key, vmap).Err()
} | go | func (s *RedisMapStore) Set(key string, value interface{}, properties ...string) error {
key, vmap, err := s.prepare(key, value, properties...)
if err != nil {
return err
}
if len(vmap) == 0 {
return nil
}
return s.client.HMSet(key, vmap).Err()
} | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"Set",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"properties",
"...",
"string",
")",
"error",
"{",
"key",
",",
"vmap",
",",
"err",
":=",
"s",
".",
"prepare",
"(",
"key",
",",
"value... | // Set a record, prepending the prefix to the key if necessary, optionally setting only the given properties | [
"Set",
"a",
"record",
"prepending",
"the",
"prefix",
"to",
"the",
"key",
"if",
"necessary",
"optionally",
"setting",
"only",
"the",
"given",
"properties"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L193-L202 |
22,899 | TheThingsNetwork/ttn | core/storage/redis_map_store.go | Create | func (s *RedisMapStore) Create(key string, value interface{}, properties ...string) error {
key, vmap, err := s.prepare(key, value, properties...)
if err != nil {
return err
}
if len(vmap) == 0 {
return nil
}
err = s.client.Watch(func(tx *redis.Tx) error {
exists, err := tx.Exists(key).Result()
if err != ... | go | func (s *RedisMapStore) Create(key string, value interface{}, properties ...string) error {
key, vmap, err := s.prepare(key, value, properties...)
if err != nil {
return err
}
if len(vmap) == 0 {
return nil
}
err = s.client.Watch(func(tx *redis.Tx) error {
exists, err := tx.Exists(key).Result()
if err != ... | [
"func",
"(",
"s",
"*",
"RedisMapStore",
")",
"Create",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"properties",
"...",
"string",
")",
"error",
"{",
"key",
",",
"vmap",
",",
"err",
":=",
"s",
".",
"prepare",
"(",
"key",
",",
"va... | // Create a new record, prepending the prefix to the key if necessary, optionally setting only the given properties
// This function returns an error if the record already exists | [
"Create",
"a",
"new",
"record",
"prepending",
"the",
"prefix",
"to",
"the",
"key",
"if",
"necessary",
"optionally",
"setting",
"only",
"the",
"given",
"properties",
"This",
"function",
"returns",
"an",
"error",
"if",
"the",
"record",
"already",
"exists"
] | fc5709a55c20e1712047e5cb5a8d571aa62eefbb | https://github.com/TheThingsNetwork/ttn/blob/fc5709a55c20e1712047e5cb5a8d571aa62eefbb/core/storage/redis_map_store.go#L206-L235 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.