diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2011-05-13 07:44:42 -0700 |
---|---|---|
committer | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-05-25 09:00:42 -0500 |
commit | 6ec6169215eb33683728c583e231eb5fe9617813 (patch) | |
tree | 3b06bb912d42705490e8e1ae3856f71f7f7be1e3 /org.eclipse.jgit.storage.dht/resources | |
parent | 7cad0adc7dd0f1ce261a11b16bd1725a12827161 (diff) | |
download | jgit-6ec6169215eb33683728c583e231eb5fe9617813.tar.gz jgit-6ec6169215eb33683728c583e231eb5fe9617813.zip |
DHT: Replace TinyProtobuf with Google Protocol Buffers
The standard Google distribution of Protocol Buffers in Java is better
maintained than TinyProtobuf, and should be faster for most uses. It
does use slightly more memory due to many of our key types being
stored as strings in protobuf messages, but this is probably worth the
small hit to memory in exchange for better maintained code that is
easier to reuse in other applications.
Exposing all of our data members to the underlying implementation
makes it easier to develop reporting and data mining tools, or to
expand out a nested structure like RefData into a flat format in a SQL
database table.
Since the C++ `protoc` tool is necessary to convert the protobuf
script into Java code, the generated files are committed as part of
the source repository to make it easier for developers who do not have
this tool installed to still build the overall JGit package and make
use of it. Reviewers will need to be careful to ensure that any edits
made to a *.proto file come in a commit that also updates the
generated code to match.
CQ: 5135
Change-Id: I53e11e82c186b9cf0d7b368e0276519e6a0b2893
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.storage.dht/resources')
-rw-r--r-- | org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/DhtText.properties | 11 | ||||
-rw-r--r-- | org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/git_store.proto | 264 |
2 files changed, 4 insertions, 271 deletions
diff --git a/org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/DhtText.properties b/org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/DhtText.properties index c004fda7ac..d53147abf6 100644 --- a/org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/DhtText.properties +++ b/org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/DhtText.properties @@ -4,9 +4,12 @@ corruptCompressedObject=Corrupt deflate stream in {0} at {1} cycleInDeltaChain=Cycle in delta chain {0} offset {1} databaseRequired=Database is required expectedObjectSizeDuringCopyAsIs=Object {0} has size of 0 +invalidCachedPackInfo=Invalid CachedPackInfo on {0} {1} invalidChunkKey=Invalid ChunkKey {0} +invalidChunkMeta=Invalid ChunkMeta on {0} invalidObjectIndexKey=Invalid ObjectIndexKey {0} -invalidObjectInfo=Invalid ObjectInfo on {0} +invalidObjectInfo=Invalid ObjectInfo for {0} from {1} +invalidRefData=Invalid RefData on {0} missingChunk=Missing {0} missingLongOffsetBase=Missing base for offset -{1} in meta of {0} nameRequired=Name or key is required @@ -17,12 +20,6 @@ objectListCountingFrom=Counting objects in {0} objectTypeUnknown=unknown packParserInvalidPointer=Invalid pointer inside pack parser: {0}, chunk {1}, offset {2}. packParserRollbackFailed=DhtPackParser rollback failed -protobufNegativeValuesNotSupported=Negative values are not supported -protobufNoArray=bytes field requires ByteBuffer.hasArray to be true -protobufNotBooleanValue=bool field {0} has invalid value {1} -protobufUnsupportedFieldType=Unsupported protobuf field type {0} -protobufWrongFieldLength=Field {0} should have length of {1}, found {2} -protobufWrongFieldType=Field {0} is of type {1}, expected {2} recordingObjects=Recording objects repositoryAlreadyExists=Repository {0} already exists repositoryMustBeBare=Only bare repositories are supported diff --git a/org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/git_store.proto b/org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/git_store.proto deleted file mode 100644 index d6674055a1..0000000000 --- a/org.eclipse.jgit.storage.dht/resources/org/eclipse/jgit/storage/dht/git_store.proto +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright (C) 2011, Google Inc. -// and other copyright owners as documented in the project's IP log. -// -// This program and the accompanying materials are made available -// under the terms of the Eclipse Distribution License v1.0 which -// accompanies this distribution, is reproduced below, and is -// available at http://www.eclipse.org/org/documents/edl-v10.php -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or -// without modification, are permitted provided that the following -// conditions are met: -// -// - Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// - Neither the name of the Eclipse Foundation, Inc. nor the -// names of its contributors may be used to endorse or promote -// products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package git_store; -option java_package = "org.eclipse.jgit.storage.dht.proto"; - - - // Entry in RefTable describing the target of the reference. - // Either symref *OR* target must be populated, but never both. - // -message RefData { - // An ObjectId with an optional hint about where it can be found. - // - message Id { - required string object_name = 1; - optional string chunk_key = 2; - } - - // Name of another reference this reference inherits its target - // from. The target is inherited on-the-fly at runtime by reading - // the other reference. Typically only "HEAD" uses symref. - // - optional string symref = 1; - - // ObjectId this reference currently points at. - // - optional Id target = 2; - - // True if the correct value for peeled is stored. - // - optional bool is_peeled = 3; - - // If is_peeled is true, this field is accurate. This field - // exists only if target points to annotated tag object, then - // this field stores the "object" field for that tag. - // - optional Id peeled = 4; -} - - - // Entry in ObjectIndexTable, describes how an object appears in a chunk. - // -message ObjectInfo { - // Type of Git object. - // - enum ObjectType { - COMMIT = 1; - TREE = 2; - BLOB = 3; - TAG = 4; - } - optional ObjectType object_type = 1; - - // Position of the object's header within its chunk. - // - required int32 offset = 2; - - // Total number of compressed data bytes, not including the pack - // header. For fragmented objects this is the sum of all chunks. - // - required int64 packed_size = 3; - - // Total number of bytes of the uncompressed object. For a - // delta this is the size after applying the delta onto its base. - // - required int64 inflated_size = 4; - - // ObjectId of the delta base, if this object is stored as a delta. - // The base is stored in raw binary. - // - optional bytes delta_base = 5; - - // True if the object requires more than one chunk to be stored. - // - optional bool is_fragmented = 6; -} - - - // Describes at a high-level the information about a chunk. - // A repository can use this summary to determine how much - // data is stored, or when garbage collection should occur. - // -message ChunkInfo { - // Source of the chunk (what code path created it). - // - enum Source { - RECEIVE = 1; // Came in over the network from external source. - INSERT = 2; // Created in this repository (e.g. a merge). - REPACK = 3; // Generated during a repack of this repository. - } - optional Source source = 1; - - // Type of Git object stored in this chunk. - // - enum ObjectType { - MIXED = 0; - COMMIT = 1; - TREE = 2; - BLOB = 3; - TAG = 4; - } - optional ObjectType object_type = 2; - - // True if this chunk is a member of a fragmented object. - // - optional bool is_fragment = 3; - - // If present, key of the CachedPackInfo object - // that this chunk is a member of. - // - optional string cached_pack_key = 4; - - // Summary description of the objects stored here. - // - message ObjectCounts { - // Number of objects stored in this chunk. - // - optional int32 total = 1; - - // Number of objects stored in whole (non-delta) form. - // - optional int32 whole = 2; - - // Number of objects stored in OFS_DELTA format. - // The delta base appears in the same chunk, or - // may appear in an earlier chunk through the - // ChunkMeta.base_chunk link. - // - optional int32 ofs_delta = 3; - - // Number of objects stored in REF_DELTA format. - // The delta base is at an unknown location. - // - optional int32 ref_delta = 4; - } - optional ObjectCounts object_counts = 5; - - // Size in bytes of the chunk's compressed data column. - // - optional int32 chunk_size = 6; - - // Size in bytes of the chunk's index. - // - optional int32 index_size = 7; - - // Size in bytes of the meta information. - // - optional int32 meta_size = 8; -} - - - // Describes meta information about a chunk, stored inline with it. - // -message ChunkMeta { - // Enumerates the other chunks this chunk depends upon by OFS_DELTA. - // Entries are sorted by relative_start ascending, enabling search. Thus - // the earliest chunk is at the end of the list. - // - message BaseChunk { - // Bytes between start of the base chunk and start of this chunk. - // Although the value is positive, its a negative offset. - // - required int64 relative_start = 1; - required string chunk_key = 2; - } - repeated BaseChunk base_chunk = 1; - - // If this chunk is part of a fragment, key of every chunk that - // makes up the fragment, including this chunk. - // - repeated string fragment = 2; - - // Chunks that should be prefetched if reading the current chunk. - // - message PrefetchHint { - repeated string edge = 1; - repeated string sequential = 2; - } - optional PrefetchHint commit_prefetch = 51; - optional PrefetchHint tree_prefetch = 52; -} - - - // Describes a CachedPack, for efficient bulk clones. - // -message CachedPackInfo { - // Unique name of the cached pack. This is the SHA-1 hash of - // all of the objects that make up the cached pack, sorted and - // in binary form. (Same rules as Git on the filesystem.) - // - required string name = 1; - - // SHA-1 of all chunk keys, which are themselves SHA-1s of the - // raw chunk data. If any bit differs in compression (due to - // repacking) the version will differ. - // - required string version = 2; - - // Total number of objects in the cached pack. This must be known - // in order to set the final resulting pack header correctly before it - // is sent to clients. - // - required int64 objects_total = 3; - - // Number of objects stored as deltas, rather than deflated whole. - // - optional int64 objects_delta = 4; - - // Total size of the chunks, in bytes, not including the chunk footer. - // - optional int64 bytes_total = 5; - - // Objects this pack starts from. - // - message TipObjectList { - repeated string object_name = 1; - } - required TipObjectList tip_list = 6; - - // Chunks, in order of occurrence in the stream. - // - message ChunkList { - repeated string chunk_key = 1; - } - required ChunkList chunk_list = 7; -} |