| Index: blimp/helium/version_vector.cc
|
| diff --git a/blimp/helium/version_vector.cc b/blimp/helium/version_vector.cc
|
| deleted file mode 100644
|
| index d1843e586a0ddd8c8c71757a0e722656967e4267..0000000000000000000000000000000000000000
|
| --- a/blimp/helium/version_vector.cc
|
| +++ /dev/null
|
| @@ -1,85 +0,0 @@
|
| -// Copyright 2016 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "blimp/helium/version_vector.h"
|
| -
|
| -#include <algorithm>
|
| -
|
| -#include "base/logging.h"
|
| -
|
| -namespace blimp {
|
| -namespace helium {
|
| -
|
| -VersionVector::VersionVector() {}
|
| -
|
| -VersionVector::VersionVector(Revision local_revision, Revision remote_revision)
|
| - : local_revision_(local_revision), remote_revision_(remote_revision) {}
|
| -
|
| -VersionVector::Comparison VersionVector::CompareTo(
|
| - const VersionVector& other) const {
|
| - DCHECK_GE(local_revision_, other.local_revision());
|
| -
|
| - if (local_revision_ == other.local_revision()) {
|
| - if (remote_revision_ == other.remote_revision()) {
|
| - return VersionVector::Comparison::EqualTo;
|
| - } else if (remote_revision_ < other.remote_revision()) {
|
| - return VersionVector::Comparison::LessThan;
|
| - } else {
|
| - return VersionVector::Comparison::GreaterThan;
|
| - }
|
| - } else {
|
| - if (local_revision_ > other.local_revision()) {
|
| - if (remote_revision_ == other.remote_revision()) {
|
| - return VersionVector::Comparison::GreaterThan;
|
| - } else {
|
| - return VersionVector::Comparison::Conflict;
|
| - }
|
| - } else { // We know its not equal or greater, so its smaller
|
| - if (remote_revision_ == other.remote_revision()) {
|
| - return VersionVector::Comparison::LessThan;
|
| - } else {
|
| - LOG(FATAL) << "Local revision should always be greater or equal.";
|
| - return VersionVector::Comparison::Conflict;
|
| - }
|
| - }
|
| - }
|
| -}
|
| -
|
| -VersionVector::Comparison VersionVector::CompareWithBias(
|
| - const VersionVector& other,
|
| - Bias bias) const {
|
| - Comparison cmp = CompareTo(other);
|
| - if (cmp == Comparison::Conflict) {
|
| - if (bias == Bias::REMOTE) {
|
| - return Comparison::LessThan;
|
| - } else if (bias == Bias::LOCAL) {
|
| - return Comparison::GreaterThan;
|
| - }
|
| - }
|
| - return cmp;
|
| -}
|
| -
|
| -VersionVector VersionVector::MergeWith(const VersionVector& other) const {
|
| - VersionVector result(std::max(local_revision_, other.local_revision()),
|
| - std::max(remote_revision_, other.remote_revision()));
|
| - return result;
|
| -}
|
| -
|
| -void VersionVector::IncrementLocal() {
|
| - local_revision_++;
|
| -}
|
| -
|
| -proto::VersionVectorMessage VersionVector::ToProto() const {
|
| - proto::VersionVectorMessage result;
|
| - result.set_local_revision(local_revision_);
|
| - result.set_remote_revision(remote_revision_);
|
| - return result;
|
| -}
|
| -
|
| -VersionVector VersionVector::Invert() const {
|
| - return VersionVector(remote_revision_, local_revision_);
|
| -}
|
| -
|
| -} // namespace helium
|
| -} // namespace blimp
|
|
|