The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/services/store/object/sqlstash/utils.go

27 lines
513 B

package sqlstash
import (
"crypto/md5"
"encoding/hex"
"strings"
"github.com/grafana/grafana/pkg/models"
)
func createContentsHash(contents []byte) string {
hash := md5.Sum(contents)
return hex.EncodeToString(hash[:])
}
func getParentFolderPath(kind string, key string) string {
idx := strings.LastIndex(key, "/")
if idx < 0 {
return "" // ?
}
// folder should have a parent up one directory
if kind == models.StandardKindFolder {
idx = strings.LastIndex(key[:idx], "/")
}
return key[:idx]
}