Apache Mesos
catchup.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __LOG_CATCHUP_HPP__
18 #define __LOG_CATCHUP_HPP__
19 
20 #include <stdint.h>
21 
22 #include <process/future.hpp>
23 #include <process/shared.hpp>
24 
25 #include <stout/duration.hpp>
26 #include <stout/interval.hpp>
27 #include <stout/nothing.hpp>
28 #include <stout/option.hpp>
29 
30 #include "log/network.hpp"
31 #include "log/replica.hpp"
32 
33 namespace mesos {
34 namespace internal {
35 namespace log {
36 
37 // Catches-up a set of log positions in the local replica. The user of
38 // this function can provide a hint on the proposal number that will
39 // be used for Paxos. This could potentially save us a few Paxos
40 // rounds. However, if the user has no idea what proposal number to
41 // use, they can just use none. We also allow the user to specify a
42 // timeout for the catch-up operation on each position and retry the
43 // operation if timeout happens. This can help us tolerate network
44 // blips.
46  size_t quorum,
47  const process::Shared<Replica>& replica,
48  const process::Shared<Network>& network,
49  const Option<uint64_t>& proposal,
50  const IntervalSet<uint64_t>& positions,
51  const Duration& timeout = Seconds(10));
52 
53 
54 // Catches-up missing log positions in the local replica. Returns the
55 // highest position that was caught-up and now is safe to read. The
56 // user of this function can provide a hint on the proposal number
57 // that will be used for Paxos. We also allow the user to specify a
58 // timeout for the catch-up operation on each position and retry the
59 // operation if timeout happens.
61  size_t quorum,
62  const process::Shared<Replica>& replica,
63  const process::Shared<Network>& network,
64  const Option<uint64_t>& proposal = None(),
65  const Duration& timeout = Seconds(10));
66 
67 } // namespace log {
68 } // namespace internal {
69 } // namespace mesos {
70 
71 #endif // __LOG_CATCHUP_HPP__
Definition: duration.hpp:32
Definition: owned.hpp:26
Definition: duration.hpp:207
Definition: agent.hpp:25
Definition: none.hpp:27
Definition: attributes.hpp:24
process::Future< Nothing > catchup(size_t quorum, const process::Shared< Replica > &replica, const process::Shared< Network > &network, const Option< uint64_t > &proposal, const IntervalSet< uint64_t > &positions, const Duration &timeout=Seconds(10))