MCPcopy Create free account
hub / github.com/apple/foundationdb / getCommittedVersion

Function getCommittedVersion

fdbserver/SimpleConfigConsumer.actor.cpp:25–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include "flow/actorcompiler.h" // must be last include
24
25class SimpleConfigConsumerImpl {
26 ConfigFollowerInterface cfi;
27 Version lastSeenVersion{ 0 };
28 double pollingInterval;
29 Optional<double> compactionInterval;
30
31 UID id;
32 CounterCollection cc;
33 Counter compactRequest;
34 Counter successfulChangeRequest;
35 Counter failedChangeRequest;
36 Counter snapshotRequest;
37 Future<Void> logger;
38
39 ACTOR static Future<Void> compactor(SimpleConfigConsumerImpl* self, ConfigBroadcaster* broadcaster) {
40 if (!self->compactionInterval.present()) {
41 wait(Never());
42 return Void();
43 }
44 loop {
45 state Version compactionVersion = self->lastSeenVersion;
46 wait(delayJittered(self->compactionInterval.get()));
47 if (self->cfi.hostname.present()) {
48 wait(retryGetReplyFromHostname(ConfigFollowerCompactRequest{ compactionVersion },
49 self->cfi.hostname.get(),
50 WLTOKEN_CONFIGFOLLOWER_COMPACT));
51 } else {
52 wait(self->cfi.compact.getReply(ConfigFollowerCompactRequest{ compactionVersion }));
53 }
54 ++self->compactRequest;
55 broadcaster->compact(compactionVersion);
56 }
57 }
58
59 ACTOR static Future<Version> getCommittedVersion(SimpleConfigConsumerImpl* self) {
60 state ConfigFollowerGetCommittedVersionReply committedVersionReply;
61 if (self->cfi.hostname.present()) {
62 wait(store(committedVersionReply,
63 retryGetReplyFromHostname(ConfigFollowerGetCommittedVersionRequest{},
64 self->cfi.hostname.get(),
65 WLTOKEN_CONFIGFOLLOWER_GETCOMMITTEDVERSION)));
66 } else {
67 wait(store(committedVersionReply,
68 self->cfi.getCommittedVersion.getReply(ConfigFollowerGetCommittedVersionRequest{})));
69 }
70 return committedVersionReply.lastCommitted;
71 }
72
73 ACTOR static Future<Void> fetchChanges(SimpleConfigConsumerImpl* self, ConfigBroadcaster* broadcaster) {
74 wait(getSnapshotAndChanges(self, broadcaster));

Callers 5

serveMethod · 0.70
getSnapshotAndChangesFunction · 0.70

Calls 5

storeFunction · 0.85
getMethod · 0.65
presentMethod · 0.45
getReplyMethod · 0.45

Tested by

no test coverage detected