ROOT logo
// @(#)root/net:$Id: TAS3File.h 41144 2011-10-05 13:15:20Z 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_TAS3File
#define ROOT_TAS3File

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TAS3File                                                             //
//                                                                      //
// A TAS3File is a normal TWebFile but it reads data from the           //
// Amazon S3 server. As a derived TWebFile class TAS3File it is a       //
// read only file. The HTTP requests are generated by THTTPMessage      //
// objects with the auth_prefix set as AWS. The user id and secret pass //
// required to sign the requests are passed through the environment     //
// variables S3_ACCESS_ID and S3_ACCESS_KEY.                            //
// For more information check:                                          //
//   http://aws.amazon.com/documentation/s3/                            //
//   http://awsdocs.s3.amazonaws.com/S3/latest/s3-qrc.pdf               //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

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

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

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

class TAS3File: public TWebFile {

private:
   TAS3File();

protected:
   TString fAuthPrefix;  //Authentication prefix for Amazon S3
   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);

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

   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(TAS3File, 0)  // Read a ROOT file from the Amazon S3 cloud
};

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