diff --git a/sources/cmd/archiver/archiver.go b/sources/cmd/archiver/archiver.go index e43ffac..f82716e 100644 --- a/sources/cmd/archiver/archiver.go +++ b/sources/cmd/archiver/archiver.go @@ -418,7 +418,8 @@ func archiveReference (_context *context, _namespace string, _pathInArchive stri } _context.archivedReferences += 1 - _key := fmt.Sprintf ("%s:%s", _namespace, _pathInArchive) + _namespacePrefix := KeyNamespacePrefix (_namespace) + _key := fmt.Sprintf ("%c:%s", _namespacePrefix, _pathInArchive) var _keyMeta, _keyContent uint64 if _key_0, _error := prepareKeyUint (_context, NamespaceDataMetadata, _fingerprintMeta); _error == nil { @@ -721,7 +722,7 @@ func prepareDataContent (_context *context, _pathResolved string, _pathInArchive func prepareDataMeta (_context *context, _dataMeta map[string]string) (string, []byte, error) { var _dataMetaRaw []byte - if _dataMetaRaw_0, _error := MetadataEncode (_dataMeta); _error == nil { + if _dataMetaRaw_0, _error := MetadataEncodeBinary (_dataMeta); _error == nil { _dataMetaRaw = _dataMetaRaw_0 } else { return "", nil, _error @@ -752,7 +753,6 @@ func prepareKeyUint (_context *context, _namespace string, _fingerprint string) } else { return 0, _error } - } func prepareKeyString (_context *context, _namespace string, _fingerprint string) (string, error) { diff --git a/sources/cmd/server/server.go b/sources/cmd/server/server.go index 28d5bf7..be2c49a 100644 --- a/sources/cmd/server/server.go +++ b/sources/cmd/server/server.go @@ -182,13 +182,13 @@ func (_server *server) ServeUnwrapped (_context *fasthttp.RequestCtx) () { if _server.cachedReferences != nil { _key := _keyBufferLarge[:0] + _key = append (_key, KeyNamespacePrefix (_namespace), ':') _key = append (_key, _path ...) _key = append (_key, _pathSuffix ...) _referencesValues, _referencesFound = _server.cachedReferences[BytesToString (*NoEscapeBytes (&_key))] } else { _key := _keyBufferLarge[:0] - _key = append (_key, _namespace ...) - _key = append (_key, ':') + _key = append (_key, KeyNamespacePrefix (_namespace), ':') _key = append (_key, _path ...) _key = append (_key, _pathSuffix ...) if _value, _error := _server.cdbReader.GetWithCdbHash (_key); _error == nil { @@ -226,13 +226,13 @@ func (_server *server) ServeUnwrapped (_context *fasthttp.RequestCtx) () { if _server.cachedReferences != nil { _key := _keyBufferLarge[:0] + _key = append (_key, NamespaceFilesContentPrefix, ':') _key = append (_key, _path[: _pathLimit] ...) _key = append (_key, "/*" ...) _referencesValues, _referencesFound = _server.cachedReferences[BytesToString (*NoEscapeBytes (&_key))] } else { _key := _keyBufferLarge[:0] - _key = append (_key, NamespaceFilesContent ...) - _key = append (_key, ':') + _key = append (_key, NamespaceFilesContentPrefix, ':') _key = append (_key, _path[: _pathLimit] ...) _key = append (_key, "/*" ...) if _value, _error := _server.cdbReader.GetWithCdbHash (_key); _error == nil { @@ -353,7 +353,7 @@ func (_server *server) ServeUnwrapped (_context *fasthttp.RequestCtx) () { } } } - if _error := MetadataDecodeIterate (_dataMetaRaw, _handleHeader); _error != nil { + if _error := MetadataDecodeBinaryIterate (_dataMetaRaw, _handleHeader); _error != nil { _server.ServeError (_context, http.StatusInternalServerError, _error, false) return } @@ -1276,8 +1276,7 @@ func main_0 () (error) { var _fileReferences []byte { _key := _keyBuffer[:0] - _key = append (_key, NamespaceFilesContent ...) - _key = append (_key, ':') + _key = append (_key, NamespaceFilesContentPrefix, ':') _key = append (_key, _filePath ...) if _references_0, _error := _cdbReader.GetWithCdbHash (_key); _error == nil { if _references_0 != nil { @@ -1297,7 +1296,10 @@ func main_0 () (error) { AbortError (_error, "[7d1a366f] [cdb.....] failed indexing archive!") } if _indexPaths { - _cachedReferences[BytesToString (_filePath)] = [2]uint64 { _keyDataMeta, _keyDataContent } + _key := _keyBuffer[:0] + _key = append (_key, NamespaceFilesContentPrefix, ':') + _key = append (_key, _filePath ...) + _cachedReferences[string (_key)] = [2]uint64 { _keyDataMeta, _keyDataContent } } if _indexDataMeta { if _, _wasCached := _cachedDataMeta[_keyDataMeta]; !_wasCached { diff --git a/sources/lib/common/keys.go b/sources/lib/common/keys.go index e75d9b3..05405c4 100644 --- a/sources/lib/common/keys.go +++ b/sources/lib/common/keys.go @@ -43,7 +43,7 @@ func EncodeKeyToBytes_0 (_namespace string, _key uint64, _buffer []byte) (error) } _prefix := KeyNamespacePrefix (_namespace) if _prefix == 0 { - return fmt.Errorf ("[feece73b] invalid key namespace `%s`!", _namespace) + return fmt.Errorf ("[8c6ba154] invalid key namespace `%s`!", _namespace) } _keyPrefix := byte (_key >> 56) if _keyPrefix != _prefix {