Documentation ¶
Index ¶
- Constants
- func AsMD5Hash(b []byte) schema.MD5Hash
- func ComputeTraceValueShard(traceID schema.TraceID) byte
- func DigestToBytes(d types.Digest) (schema.DigestBytes, error)
- func FromMD5Hash(m schema.MD5Hash) []byte
- func GetConnectionURL(userHostPort, dbName string) string
- func Qualify(system, id string) string
- func Sanitize(s string) string
- func SerializeMap(m map[string]string) (string, []byte)
- func Unqualify(id string) string
Constants ¶
const TraceValuesShards = 8
TraceValuesShards is the number of shards we use in the TraceValues Table.
Variables ¶
This section is empty.
Functions ¶
func ComputeTraceValueShard ¶
ComputeTraceValueShard computes a shard in the range [0,TraceValuesShards) based off the given trace hash bytes. This shard range was chosen to be a small number (relative to the thousands of ranges that the TraceValues database occupies) that is larger than the number of nodes in the cockroachdb cluster. See the overall design doc (go/skia-gold-sql) for more explanation about data locality and sharding.
func DigestToBytes ¶
func DigestToBytes(d types.Digest) (schema.DigestBytes, error)
DigestToBytes returns the given digest as bytes. It returns an error if a missing digest is passed in or if the bytes are otherwise invalid.
func FromMD5Hash ¶
FromMD5Hash returns the given byte array a slice of bytes. The copy is required when dealing with a loop variable, as a naive slice won't work.
func GetConnectionURL ¶
GetConnectionURL returns a full connection URL with the correct protocol and connection options given the username, host, port, and database name.
func Qualify ¶
Qualify prefixes the given CL, PS or TJ id with the given system. In the SQL database, we use these qualified IDs to make the queries easier, that is, we don't have to do a join over id and system, we can just use the combined ID.
func Sanitize ¶
Sanitize removes unsafe characters from strings to avoid SQL injections. Namely quotes.
func SerializeMap ¶
SerializeMap returns the given map in JSON and the MD5 of that json string. nil maps will be treated as empty maps. Keys will be sorted lexicographically.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package databuilder provides a tool for generating test data in a way that is easy for a human to update and understand.
|
Package databuilder provides a tool for generating test data in a way that is easy for a human to update and understand. |
exporter
|
|
tosql
This executable generates a go file that contains the SQL schema for Gold defined as a string.
|
This executable generates a go file that contains the SQL schema for Gold defined as a string. |