xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdClient
XrdClientUrlSet.hh
Go to the documentation of this file.
1
2
// //
3
// XrdClientUrlSet //
4
// //
5
// Author: Fabrizio Furano (INFN Padova, 2004) //
6
// Adapted from TXNetFile (root.cern.ch) originally done by //
7
// Alvise Dorigo, Fabrizio Furano, INFN Padova, 2003 //
8
// Revised by G. Ganis, CERN, June 2005 //
9
// //
10
// A container for multiple urls to be resolved through DNS aliases //
11
// //
13
14
// $Id$
15
16
#ifndef _XRC_URLSET_H
17
#define _XRC_URLSET_H
18
19
#include "
XrdClient/XrdClientConst.hh
"
20
#include "
XrdClient/XrdClientVector.hh
"
21
#include "
XrdOuc/XrdOucString.hh
"
22
23
using namespace
std;
24
25
class
XrdClientUrlInfo
;
26
27
typedef
XrdClientVector<XrdClientUrlInfo*>
UrlArray
;
28
29
//
30
// Manages a set of XrdClientUrlInfo objects and provides a set
31
// of utilities to resolve multiple addresses from the dns
32
// and to pick urls sequentially and randomly an url
33
//
34
35
class
XrdClientUrlSet
{
36
private
:
37
UrlArray
fUrlArray
;
38
UrlArray
fTmpUrlArray
;
39
XrdOucString
fPathName
;
40
41
bool
fIsValid
;
42
unsigned
int
fSeed
;
43
44
void
CheckPort(
int
&
port
);
45
void
ConvertDNSAlias(
UrlArray
&
urls
,
XrdOucString
proto,
46
XrdOucString
host,
XrdOucString
file);
47
double
GetRandom(
int
seed = 0);
48
49
public
:
50
XrdClientUrlSet
(
XrdOucString
urls
);
51
~
XrdClientUrlSet
();
52
53
// Returns the final resolved list of servers
54
XrdOucString
GetServers();
55
56
// Gets the subsequent Url, the one after the last given
57
XrdClientUrlInfo
*GetNextUrl();
58
59
// From the remaining urls we pick a random one. Without reinsert.
60
// i.e. while there are not considered urls, never pick an already seen one
61
XrdClientUrlInfo
*GetARandomUrl();
62
// Given a seed, use that to pick an url
63
// the effect will be that, given the same list, the same seed will pick the same url
64
XrdClientUrlInfo
*GetARandomUrl(
unsigned
int
seed);
65
66
void
Rewind();
67
void
ShowUrls();
68
void
EraseUrl(
XrdClientUrlInfo
*url);
69
70
// Returns the number of urls
71
int
Size
() {
return
fUrlArray.GetSize(); }
72
73
// Returns the pathfile extracted from the CTOR's argument
74
XrdOucString
GetFile
() {
return
fPathName; }
75
76
bool
IsValid
() {
return
fIsValid; }
// Spot malformations
77
78
};
79
80
#endif
Generated by
1.8.1.2