syntax = "proto3";

import "common.proto";

package types;
option go_package = "github.com/33cn/chain33/types";

// merkle avl tree
message LeafNode {
    bytes key    = 1;
    bytes value  = 2;
    int32 height = 3;
    int32 size   = 4;
}

message InnerNode {
    bytes leftHash  = 1;
    bytes rightHash = 2;
    int32 height    = 3;
    int32 size      = 4;
}

message MAVLProof {
    bytes    leafHash             = 1;
    repeated InnerNode innerNodes = 2;
    bytes              rootHash   = 3;
}

message StoreNode {
    bytes key       = 1;
    bytes value     = 2;
    bytes leftHash  = 3;
    bytes rightHash = 4;
    int32 height    = 5;
    int32 size      = 6;
}

message LocalDBSet {
    repeated KeyValue KV = 2;
}

message LocalDBList {
    bytes prefix    = 1;
    bytes key       = 2;
    int32 direction = 3;
    int32 count     = 4;
}

message LocalDBGet {
    repeated bytes keys = 2;
}

message LocalReplyValue {
    repeated bytes values = 2;
}

message StoreSet {
    bytes    stateHash       = 1;
    repeated KeyValue KV     = 2;
    int64             height = 3;
}

message StoreDel {
    bytes stateHash = 1;
    int64 height    = 2;
}

message StoreSetWithSync {
    StoreSet storeset = 1;
    bool     sync     = 2;
}

message StoreGet {
    bytes    stateHash  = 1;
    repeated bytes keys = 2;
}

message StoreReplyValue {
    repeated bytes values = 2;
}

message StoreList {
    bytes stateHash = 1;
    bytes start     = 2;
    bytes end       = 3;
    bytes suffix    = 4;
    int64 count     = 5;
    int64 mode      = 6;
}

message StoreListReply {
    bytes    start        = 1;
    bytes    end          = 2;
    bytes    suffix       = 3;
    int64    count        = 4;
    int64    num          = 5;
    int64    mode         = 6;
    bytes    nextKey      = 7;
    repeated bytes keys   = 8;
    repeated bytes values = 9;
}

message PruneData {
    // 该叶子节点的所有父hash
    repeated bytes hashs = 1;
}

//用于存储db Pool数据的Value
message StoreValuePool {
    repeated bytes values = 1;
}