// Copyright 2016 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
option go_package = "github.com/google/trillian/storage/storagepb";

package storagepb;

// This file contains protos used only by storage. They are not exported via any
// of our public APIs.

// SubtreeProto contains nodes of a subtree.
message SubtreeProto {
  // subtree's prefix (must be a multiple of 8 bits)
  bytes prefix = 1;
  // subtree's depth
  int32 depth = 2;

  // map of suffix (within subtree) to subtree-leaf node hash
  map<string, bytes> leaves = 4;

  // Map of suffix (within subtree) to subtree-internal node hash.
  // This structure is usually used in RAM as a cache, the internal nodes of
  // the subtree are not generally stored. However internal nodes are stored for
  // partially filled log subtrees.
  map<string, bytes> internal_nodes = 5;
  // Used as a crosscheck on the internal node map by recording its expected
  // size after loading and repopulation.
  uint32 internal_node_count = 6;

  reserved 3;
}
