ROOT logo
// @(#)root/net:$Id: TGSFile.h 41631 2011-10-28 14:17:13Z rdm $
// Author: Marcelo Sousa   23/08/2011

/*************************************************************************
 * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGSFile
#define ROOT_TGSFile

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGSFile                                                              //
//                                                                      //
// A TGSFile is a normal TWebFile but it reads data from the            //
// Google Storage server. As a derived TWebFile class TGSFile it is     //
// a read only file. The HTTP requests are generated by THTTPMessage    //
// objects with the auth_prefix set as GOOG1. The user id and secret    //
// pass required to sign the requests are passed through the            //
// environment variables GT_ACCESS_ID and GT_ACCESS_KEY.                //
// For more information check:                                          //
//   http://code.google.com/apis/storage/docs/getting-started.html      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TWebFile
#include "TWebFile.h"
#endif

#ifndef ROOT_TUrl
#include "TUrl.h"
#endif

#ifndef ROOT_TString
#include "TString.h"
#endif

class TGSFile: public TWebFile {

private:
   TGSFile();
  
protected:
   TString fAuthPrefix;  //Authentication prefix for Google Storage
   TString fAccessId;    //User id 
   TString fAccessKey;   //Secret key
   TUrl    fServer;      //Server url
   TString fBucket;      //Bucket name
      
   Int_t  GetHead();
   Bool_t ReadBuffer10(char *buf, Int_t len);
   //Bool_t ReadBuffers10(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf);

public:
   TGSFile(const char *url, Option_t *opt="");
   virtual ~TGSFile() { }

   Bool_t  ReadBuffer(char *buf, Int_t len);
   Bool_t  ReadBuffer(char *buf, Long64_t pos, Int_t len) { return TWebFile::ReadBuffer(buf, pos, len); }
   TString GetAuthPrefix() const { return fAuthPrefix; }
   TString GetAccessId() const { return fAccessId; }
   TString GetAccessKey() const { return fAccessKey; }
   TUrl    GetUrl() const { return fServer; }
   TString GetBucket() const { return fBucket; }

   ClassDef(TGSFile, 0)  // Read a ROOT file from the Google Storage cloud
};

#endif
 TGSFile.h:1
 TGSFile.h:2
 TGSFile.h:3
 TGSFile.h:4
 TGSFile.h:5
 TGSFile.h:6
 TGSFile.h:7
 TGSFile.h:8
 TGSFile.h:9
 TGSFile.h:10
 TGSFile.h:11
 TGSFile.h:12
 TGSFile.h:13
 TGSFile.h:14
 TGSFile.h:15
 TGSFile.h:16
 TGSFile.h:17
 TGSFile.h:18
 TGSFile.h:19
 TGSFile.h:20
 TGSFile.h:21
 TGSFile.h:22
 TGSFile.h:23
 TGSFile.h:24
 TGSFile.h:25
 TGSFile.h:26
 TGSFile.h:27
 TGSFile.h:28
 TGSFile.h:29
 TGSFile.h:30
 TGSFile.h:31
 TGSFile.h:32
 TGSFile.h:33
 TGSFile.h:34
 TGSFile.h:35
 TGSFile.h:36
 TGSFile.h:37
 TGSFile.h:38
 TGSFile.h:39
 TGSFile.h:40
 TGSFile.h:41
 TGSFile.h:42
 TGSFile.h:43
 TGSFile.h:44
 TGSFile.h:45
 TGSFile.h:46
 TGSFile.h:47
 TGSFile.h:48
 TGSFile.h:49
 TGSFile.h:50
 TGSFile.h:51
 TGSFile.h:52
 TGSFile.h:53
 TGSFile.h:54
 TGSFile.h:55
 TGSFile.h:56
 TGSFile.h:57
 TGSFile.h:58
 TGSFile.h:59
 TGSFile.h:60
 TGSFile.h:61
 TGSFile.h:62
 TGSFile.h:63
 TGSFile.h:64
 TGSFile.h:65
 TGSFile.h:66
 TGSFile.h:67
 TGSFile.h:68
 TGSFile.h:69
 TGSFile.h:70
 TGSFile.h:71
 TGSFile.h:72
 TGSFile.h:73