forked from alibaba/tfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tfs_block_cache.h
62 lines (57 loc) · 1.46 KB
/
tfs_block_cache.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* (C) 2007-2010 Alibaba Group Holding Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*
* Version: $Id: tfs_block_cache.h 166 2011-03-15 07:35:48Z [email protected] $
*
* Authors:
* - initial release
*
*/
#ifndef TFS_TEST_BLOCK_CACHE_H_
#define TFS_TEST_BLOCK_CACHE_H_
#include <tbsys.h>
#include <gtest/gtest.h>
#include "message/message_factory.h"
#include "common/define.h"
#include "new_client/tfs_client_impl.h"
#include "new_client/tfs_session.h"
#include <vector>
#include <string>
struct FileRecord
{
std::string file_name_;
uint32_t write_crc_;
int64_t length_;
bool large_flag_;
};
class TfsBlockCacheTest : public testing::Test
{
public:
static void SetUpTestCase();
static void TearDownTestCase();
public:
static void set_ns_ip(const char* nsip);
static void write_files(const int32_t count);
static void backup_cache();
static void modify_cache(const int32_t step);
static void read_files(const int32_t count);
static void check_cache();
static void shuffle_files();
public:
static std::vector<FileRecord> tfs_files_;
static tfs::client::TfsSession::BLOCK_CACHE_MAP bak_cache_;
static std::string ns_ip_;
};
struct DsSort
{
bool operator()(const uint64_t left, const uint64_t right) const
{
return (left < right);
}
};
#endif