aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/datastore/handle.h
blob: 690e71228d984f13eab1dfa8610e46eea6cce546 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "entryref.h"

namespace vespalib::datastore {

/**
 * Handle to data allocated in a data store and a EntryRef used for read-only access to data later.
 */
template <typename EntryT>
struct Handle
{
    EntryRef ref;
    EntryT *data;
    Handle(EntryRef ref_, EntryT *data_) : ref(ref_), data(data_) {}
    Handle() : ref(), data() {}
    bool operator==(const Handle<EntryT> &rhs) const {
        return ref == rhs.ref &&
                data == rhs.data;
    }
};

}