aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/reference/pending_gid_to_lid_changes.cpp
blob: 143a125928537adfdc605fa42acb1602f28111cb (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
28
29
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "pending_gid_to_lid_changes.h"
#include "gid_to_lid_change_handler.h"

namespace proton {

PendingGidToLidChanges::PendingGidToLidChanges(GidToLidChangeHandler& handler, std::vector<PendingGidToLidChange> &&pending_changes)
    : IPendingGidToLidChanges(),
      _handler(handler),
      _pending_changes(std::move(pending_changes))
{
}

PendingGidToLidChanges::~PendingGidToLidChanges() = default;

void
PendingGidToLidChanges::notify_done()
{
    for (auto& change : _pending_changes) {
        if (change.is_remove()) {
            _handler.notifyRemoveDone(change.get_gid(), change.get_serial_num());
        } else {
            _handler.notifyPutDone(std::move(change).steal_context(), change.get_gid(), change.get_lid(), change.get_serial_num());
        }
    }
}

}