代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/telegraf 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package influxdb
import "fmt"
// Length of components of measurement names.
const (
OrgIDLength = 8
BucketIDLength = 8
MeasurementLength = OrgIDLength + BucketIDLength
)
// ReadMeasurement reads the provided measurement name and returns an Org ID and
// bucket ID. It returns an error if the provided name has an invalid length.
//
// ReadMeasurement does not allocate, and instead returns sub-slices of name,
// so callers should be careful about subsequent mutations to the provided name
// slice.
func ReadMeasurement(name []byte) (orgID, bucketID []byte, err error) {
if len(name) != MeasurementLength {
return nil, nil, fmt.Errorf("measurement %v has invalid length (%d)", name, len(name))
}
return name[:OrgIDLength], name[len(name)-BucketIDLength:], nil
}
// CreateMeasurement returns 16 bytes that represent a measurement.
//
// If either org or bucket are short then an error is returned, otherwise the
// first 8 bytes of each are combined and returned.
func CreateMeasurement(org, bucket []byte) ([]byte, error) {
if len(org) < OrgIDLength {
return nil, fmt.Errorf("org %v has invalid length (%d)", org, len(org))
} else if len(bucket) < BucketIDLength {
return nil, fmt.Errorf("bucket %v has invalid length (%d)", bucket, len(bucket))
}
name := make([]byte, 0, MeasurementLength)
name = append(name, org[:OrgIDLength]...)
return append(name, bucket[:BucketIDLength]...), nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。