IdBloomFilterFormat.h 1.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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.

#pragma once

#include <memory>
G
groot 已提交
21
#include <string>
22 23

#include "segment/IdBloomFilter.h"
Y
yudong.cai 已提交
24
#include "storage/FSHandler.h"
G
groot 已提交
25
#include "utils/Status.h"
26 27 28 29 30 31

namespace milvus {
namespace codec {

class IdBloomFilterFormat {
 public:
G
groot 已提交
32
    IdBloomFilterFormat() = default;
33

G
groot 已提交
34
    static std::string
G
groot 已提交
35
    FilePostfix();
36

G
groot 已提交
37
    Status
G
groot 已提交
38 39 40
    Read(const storage::FSHandlerPtr& fs_ptr, const std::string& file_path,
         segment::IdBloomFilterPtr& id_bloom_filter_ptr);

G
groot 已提交
41
    Status
G
groot 已提交
42 43 44
    Write(const storage::FSHandlerPtr& fs_ptr, const std::string& file_path,
          const segment::IdBloomFilterPtr& id_bloom_filter_ptr);

G
groot 已提交
45
    Status
G
groot 已提交
46 47 48 49 50 51 52 53 54 55 56
    Create(const storage::FSHandlerPtr& fs_ptr, const std::string& file_path,
           segment::IdBloomFilterPtr& id_bloom_filter_ptr);

    // No copy and move
    IdBloomFilterFormat(const IdBloomFilterFormat&) = delete;
    IdBloomFilterFormat(IdBloomFilterFormat&&) = delete;

    IdBloomFilterFormat&
    operator=(const IdBloomFilterFormat&) = delete;
    IdBloomFilterFormat&
    operator=(IdBloomFilterFormat&&) = delete;
57 58 59 60 61 62
};

using IdBloomFilterFormatPtr = std::shared_ptr<IdBloomFilterFormat>;

}  // namespace codec
}  // namespace milvus