mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
5070d76451
Summary: unloadChildrenNow would only unload files or trees at the leaf. Apply the fixes from D8302998 to unloadChildrenNow, which is only called during takeover. Reviewed By: strager Differential Revision: D9774970 fbshipit-source-id: c2f4d1e6b838cc3b9e99eb8786114e643128a519
38 lines
971 B
C++
38 lines
971 B
C++
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include <gtest/gtest.h>
|
|
#include "eden/fs/inodes/TreeInode.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
struct ConditionalUnloader {
|
|
static size_t unload(TreeInode& unloadFrom) {
|
|
timespec endOfTime;
|
|
endOfTime.tv_sec = std::numeric_limits<time_t>::max();
|
|
endOfTime.tv_nsec = 999999999;
|
|
return unloadFrom.unloadChildrenLastAccessedBefore(endOfTime);
|
|
}
|
|
};
|
|
|
|
struct UnconditionalUnloader {
|
|
static size_t unload(TreeInode& unloadFrom) {
|
|
return unloadFrom.unloadChildrenNow();
|
|
}
|
|
};
|
|
|
|
using InodeUnloaderTypes =
|
|
::testing::Types<ConditionalUnloader, UnconditionalUnloader>;
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|