Пример #1
0
func SetBlock(e storage.Tx, domain string, id *uuid.UUID, idx int, bytes []byte) (int, error) {
	var key string

	key = fmt.Sprintf(blockKey, id, idx)

	return len(bytes), e.Set(domain, key, bytes)
}
Пример #2
0
func SetLog(e storage.Tx, domain string, log *Log) (int, error) {
	var (
		bytes []byte
		err   error
		key   string
	)

	if bytes, err = marshalLog(log); err != nil {
		return 0, err
	}

	key = fmt.Sprintf(logKey, log.Name)

	return len(bytes), e.Set(domain, key, bytes)
}
Пример #3
0
func SetSegment(e storage.Tx, domain string, segment *Segment) (int, error) {
	var (
		bytes []byte
		err   error
		key   string
	)

	if bytes, err = marshalSegment(segment); err != nil {
		return 0, err
	}

	key = fmt.Sprintf(segmentKey, segment.UUID)

	return len(bytes), e.Set(domain, key, bytes)
}