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
63
64
65
66
67
68
69
70
71
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#include "include/types.h"
#include "msg/msg_types.h"
#include "common/Formatter.h"
#include "cls_lock_types.h"
using namespace rados::cls::lock;
static void generate_lock_id(locker_id_t& i, int n, const string& cookie)
{
i.locker = entity_name_t(entity_name_t::CLIENT(n));
i.cookie = cookie;
}
void locker_id_t::dump(Formatter *f) const
{
f->dump_stream("locker") << locker;
f->dump_string("cookie", cookie);
}
void locker_id_t::generate_test_instances(list<locker_id_t*>& o)
{
locker_id_t *i = new locker_id_t;
generate_lock_id(*i, 1, "cookie");
o.push_back(i);
o.push_back(new locker_id_t);
}
void locker_info_t::dump(Formatter *f) const
{
f->dump_stream("expiration") << expiration;
f->dump_stream("addr") << addr;
f->dump_string("description", description);
}
static void generate_test_addr(entity_addr_t& a, int nonce, int port)
{
a.set_nonce(nonce);
a.set_family(AF_INET);
a.set_in4_quad(0, 127);
a.set_in4_quad(0, 0);
a.set_in4_quad(0, 1);
a.set_in4_quad(0, 2);
a.set_port(port);
}
void locker_info_t::generate_test_instances(list<locker_info_t*>& o)
{
locker_info_t *i = new locker_info_t;
i->expiration = utime_t(5, 0);
generate_test_addr(i->addr, 1, 2);
i->description = "description";
o.push_back(i);
o.push_back(new locker_info_t);
}
|