Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TParallelMergingFile.h
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: Philippe Canal October 2011.
3
4/*************************************************************************
5 * Copyright (C) 1995-2011, Rene Brun, Fons Rademakers and al. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TParallelMergingFile
13#define ROOT_TParallelMergingFile
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TParallelMergingFile //
19// //
20// Specialization of TMemFile to connect to a parallel file merger. //
21// Upon a call to UploadAndReset, the content already written to the //
22// file is upload to the server and the object implementing the function//
23// ResetAfterMerge (like TTree) are reset. //
24// The parallel file merger will then collate the information coming //
25// from this client and any other client in to the file described by //
26// the filename of this object. //
27// //
28//////////////////////////////////////////////////////////////////////////
29
30#include "TMemFile.h"
31#include "TMessage.h"
32#include "TUrl.h"
33#include <memory>
34
35
36class TSocket;
37class TArrayC;
38
40{
41private:
42 std::unique_ptr<TSocket> fSocket; // Socket to the parallel file merger server.
43 TUrl fServerLocation; // Url of the server.
44 Int_t fServerIdx = -1; // Index of this socket/file on the server.
45 Int_t fServerVersion = 0; // Protocol version used by the server.
46 std::unique_ptr<TArrayC> fClassSent; // Record which StreamerInfo we already sent.
48
49public:
50 TParallelMergingFile(const char *filename, Option_t *option = "", const char *ftitle = "", Int_t compress = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault);
52
53 void Close(Option_t *option="") override;
56 Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override;
57 Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) const override;
58 void WriteStreamerInfo() override;
59
60 Int_t GetServerIdx() const { return fServerIdx; }
61
62 ClassDefOverride(TParallelMergingFile, 0); // TFile specialization that will semi-automatically upload its content to a merging server.
63};
64
65#endif // ROOT_TParallelMergingFile
@ kMESS_OBJECT
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:148
Array of chars or bytes (8 bits per element).
Definition TArrayC.h:27
TMemFile(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Long64_t defBlockSize=0LL)
Usual Constructor.
Definition TMemFile.cxx:161
std::unique_ptr< TArrayC > fClassSent
std::unique_ptr< TSocket > fSocket
Bool_t OpenConnection()
Attempts to connect to the server.
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write memory objects to this file and upload them to the parallel merge server.
TParallelMergingFile(const char *filename, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Constructor.
void WriteStreamerInfo() override
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
void Close(Option_t *option="") override
Close a file.
Bool_t UploadAndReset()
Upload the current file data to the merging server.
This class implements client sockets.
Definition TSocket.h:39
This class represents a WWW compatible URL.
Definition TUrl.h:33
@ kUseCompiledDefault
Use the compile-time default setting.
Definition Compression.h:53