aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/datastore/entry_comparator.h
blob: 9de2628b3187d7e22caae3dca3d36531e356daf3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "entryref.h"

namespace vespalib::datastore {

/**
 * Less-than comparator for two entries based on entry refs.
 *
 * Valid entry ref is mapped to an entry in a data store.
 * Invalid entry ref is mapped to a temporary entry owned or referenced by comparator instance.
 */
class EntryComparator {
public:
    virtual ~EntryComparator() {}

    /**
     * Returns true if the value represented by lhs ref is less than the value represented by rhs ref.
     */
    virtual bool less(const EntryRef lhs, const EntryRef rhs) const = 0;
    virtual bool equal(const EntryRef lhs, const EntryRef rhs) const = 0;
    virtual size_t hash(const EntryRef rhs) const = 0;
};

}