// Copyright 2023 Greptime Team
//
// 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";

package greptime.v1.index;

option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1/index";

// BloomFilterMeta defines the metadata for a bloom filter.
message BloomFilterMeta {
    // The number of rows per segment.
    uint64 rows_per_segment = 1;

    // The number of segments.
    uint64 segment_count = 2;

    // The number of total rows.
    uint64 row_count = 3;

    // The size of the bloom filter in bytes excluding the metadata.
    uint64 bloom_filter_size = 4;

    // The indices to the bloom filter location of each segment.
    repeated uint64 segment_loc_indices = 5;

    // The bloom filter locations.
    repeated BloomFilterLoc bloom_filter_locs = 6;
}

// BloomFilterLoc defines the location of a bloom filter.
message BloomFilterLoc {
    // The byte offset of the bloom filter data.
    uint64 offset = 1;

    // The size of the bloom filter data.
    uint64 size = 2;

    // The number of elements in the bloom filter.
    uint64 element_count = 3;
}
