├── RPresto ├── NAMESPACE ├── DESCRIPTION ├── INSTALL ├── man │ ├── RPresto-package.Rd │ └── PrestoClient-class.Rd ├── README ├── LICENSE └── R │ └── RPresto.R ├── python ├── doc │ ├── crarr.png │ ├── frames.html │ ├── index.html │ ├── redirect.html │ ├── toc-prestoclient-module.html │ ├── toc-everything.html │ ├── toc.html │ ├── api-objects.txt │ ├── module-tree.html │ ├── class-tree.html │ ├── prestoclient-module.html │ ├── help.html │ ├── epydoc.js │ ├── epydoc.css │ └── identifier-index.html └── LICENSE ├── C ├── prestoclient │ ├── curl │ │ ├── README │ │ ├── COPYING │ │ └── include │ │ │ └── curl │ │ │ ├── stdcheaders.h │ │ │ ├── curlver.h │ │ │ ├── mprintf.h │ │ │ ├── easy.h │ │ │ ├── curlrules.h │ │ │ └── multi.h │ ├── prestoclientutils.c │ ├── prestoclienttypes.h │ └── prestoclient.h ├── doxy.sh ├── CMakeLists.txt ├── msvc │ ├── prestoclient.sln │ ├── prestoclient.vcxproj.filters │ └── prestoclient.vcxproj ├── README.md └── src │ └── main.c ├── .gitignore ├── VERSION └── README.md /RPresto/NAMESPACE: -------------------------------------------------------------------------------- 1 | exportPattern("^[[:alpha:]]+") 2 | exportClasses( 3 | "PrestoClient" 4 | ) 5 | -------------------------------------------------------------------------------- /python/doc/crarr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easydatawarehousing/prestoclient/HEAD/python/doc/crarr.png -------------------------------------------------------------------------------- /C/prestoclient/curl/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/easydatawarehousing/prestoclient/HEAD/C/prestoclient/curl/README -------------------------------------------------------------------------------- /C/doxy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This file is part of prestoclient / Easy to Oracle 3 | # Copyright (C) 2014 Ivo Herweijer 4 | doxygen doxygen/prestoclient.doxyfile 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | build 11 | eggs 12 | parts 13 | bin 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | __pycache__ 21 | 22 | # Installer logs 23 | pip-log.txt 24 | 25 | # Unit test / coverage reports 26 | .coverage 27 | .tox 28 | nosetests.xml 29 | 30 | # Translations 31 | *.mo 32 | 33 | # Mr Developer 34 | .mr.developer.cfg 35 | .project 36 | .pydevproject 37 | .Rproj.user 38 | -------------------------------------------------------------------------------- /RPresto/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: RPresto 2 | Type: Package 3 | Title: Run queries on a Presto server 4 | Version: 0.2.1 5 | Date: 2013-12-15 6 | Author: Ivo Herweijer 7 | Maintainer: Ivo Herweijer 8 | Description: PrestoClient provides a method to communicate with a Presto server. Presto is a fast query engine developed by Facebook that runs distributed queries against Hadoop HDFS servers. 9 | License: Apache License 2.0 10 | Depends: methods, RCurl, jsonlite 11 | URL: https://github.com/easydatawarehousing/prestoclient -------------------------------------------------------------------------------- /C/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.8) 2 | 3 | project(prestoclient) 4 | set(TARGET_NAME "cprestoclient") 5 | 6 | set(MY_CURL_DIR, /usr/lib/x86_64-linux-gnu) 7 | find_library(MYCURL NAMES curl HINTS ${MY_CURL_DIR}) 8 | 9 | include_directories(./prestoclient) 10 | include_directories(./prestoclient/curl) 11 | 12 | file(GLOB EasyPTOra_SOURCES src/*.c) 13 | file(GLOB prestoclient_SOURCES prestoclient/*.c) 14 | set(ALL_SOURCES ${EasyPTOra_SOURCES} ${prestoclient_SOURCES}) 15 | 16 | add_executable (${TARGET_NAME} ${ALL_SOURCES}) 17 | 18 | target_link_libraries(${TARGET_NAME} ${MYCURL}) 19 | -------------------------------------------------------------------------------- /python/doc/frames.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | API Documentation 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /python/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | API Documentation 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /C/msvc/prestoclient.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prestoclient", "prestoclient.vcxproj", "{232CA226-328A-4650-A0F0-A0BACAD8680A}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {232CA226-328A-4650-A0F0-A0BACAD8680A}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {232CA226-328A-4650-A0F0-A0BACAD8680A}.Debug|Win32.Build.0 = Debug|Win32 14 | {232CA226-328A-4650-A0F0-A0BACAD8680A}.Release|Win32.ActiveCfg = Release|Win32 15 | {232CA226-328A-4650-A0F0-A0BACAD8680A}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /C/prestoclient/curl/COPYING: -------------------------------------------------------------------------------- 1 | COPYRIGHT AND PERMISSION NOTICE 2 | 3 | Copyright (c) 1996 - 2013, Daniel Stenberg, . 4 | 5 | All rights reserved. 6 | 7 | Permission to use, copy, modify, and distribute this software for any purpose 8 | with or without fee is hereby granted, provided that the above copyright 9 | notice and this permission notice appear in all copies. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN 14 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 16 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 17 | OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | Except as contained in this notice, the name of a copyright holder shall not 20 | be used in advertising or otherwise to promote the sale, use or other dealings 21 | in this Software without prior written authorization of the copyright holder. 22 | -------------------------------------------------------------------------------- /python/doc/redirect.html: -------------------------------------------------------------------------------- 1 | Epydoc Redirect Page 2 | 3 | 4 | 5 | 6 | 7 | 8 | 18 | 19 |

Epydoc Auto-redirect page

20 | 21 |

When javascript is enabled, this page will redirect URLs of 22 | the form redirect.html#dotted.name to the 23 | documentation for the object with the given fully-qualified 24 | dotted name.

25 |

 

26 | 27 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /RPresto/INSTALL: -------------------------------------------------------------------------------- 1 | PrestoClient for R 2 | ================== 3 | 4 | Install 5 | ------- 6 | 7 | This package can be installed in R using these commands: 8 | 9 | # Uncomment next line if you don't have devtools installed yet 10 | #install.packages("devtools") 11 | library(devtools) 12 | install_github("easydatawarehousing/prestoclient/RPresto") 13 | 14 | 15 | RPresto uses packages: RCurl and jsonlite. On Linux/Debian systems it may 16 | be necessary to install libCurl, including development files. On Ubuntu 17 | this should work: 18 | 19 | sudo apt-get install curl libcurl4-openssl-dev 20 | 21 | 22 | 23 | Copyright 24 | --------- 25 | Copyright 2013 Ivo Herweijer | easydatawarehousing.com 26 | 27 | Licensed under the Apache License, Version 2.0 (the "License"); 28 | you may not use this file except in compliance with the License. 29 | You may obtain a copy of the License at: 30 | 31 | http://www.apache.org/licenses/LICENSE-2.0 32 | 33 | Unless required by applicable law or agreed to in writing, software 34 | distributed under the License is distributed on an "AS IS" BASIS, 35 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 36 | See the License for the specific language governing permissions and 37 | limitations under the License. 38 | -------------------------------------------------------------------------------- /python/doc/toc-prestoclient-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | prestoclient 7 | 8 | 9 | 10 | 11 | 13 |

Module prestoclient

14 |
15 |

Classes

16 | PrestoClient

Variables

18 | __package__

20 | [hide private] 22 | 23 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /python/doc/toc-everything.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Everything 7 | 8 | 9 | 10 | 11 | 13 |

Everything

14 |
15 |

All Classes

16 | prestoclient.PrestoClient

All Variables

18 | prestoclient.__package__

20 | [hide private] 22 | 23 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /python/doc/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Table of Contents 7 | 8 | 9 | 10 | 11 | 13 |

Table of Contents

14 |
15 | Everything 16 |
17 |

Modules

18 | prestoclient

20 | [hide private] 22 | 23 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | VERSION INFORMATION: PrestoClient 2 | ================================= 3 | 4 | Version 0.3.0 BETA - Jan 30, 2014 5 | --------------------------------- 6 | - Added the C version. This includes a sample application but is meant to be 7 | the basis for other software in need of a way to communicate with a Presto 8 | server. Note that the license for the C version is GPLv3 to be in line with 9 | other software that I intend to use this with. 10 | - Update to Python version: Made it a bit quicker by lowering the time 11 | between requests to the Presto server when data is being recieved. 12 | Added the runquery function. 13 | 14 | Version 0.2.1 BETA - Dec 15, 2013 15 | --------------------------------- 16 | - Added the R version 17 | 18 | Version 0.2.0 BETA - Dec 03, 2013 19 | --------------------------------- 20 | Python version: 21 | - Client properly detects when a request is finished. The instance of the 22 | client may then be re-used for a new query 23 | - Updated the presto client protocol. Client no longer uses the 'state' 24 | variable, only the presence of a 'nextUri' link. 25 | If server responds with http code 503, the request will be retried. 26 | - Some changes in naming of methods 27 | - Added the error message from the database if the query failed 28 | - Improved error handling 29 | - Updated documentation 30 | 31 | Version 0.1.0 BETA - Nov 28, 2013 32 | --------------------------------- 33 | - This the first public release. Support for Python 34 | -------------------------------------------------------------------------------- /C/prestoclient/curl/include/curl/stdcheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDC_HEADERS_H 2 | #define __STDC_HEADERS_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | 27 | size_t fread (void *, size_t, size_t, FILE *); 28 | size_t fwrite (const void *, size_t, size_t, FILE *); 29 | 30 | int strcasecmp(const char *, const char *); 31 | int strncasecmp(const char *, const char *, size_t); 32 | 33 | #endif /* __STDC_HEADERS_H */ 34 | -------------------------------------------------------------------------------- /RPresto/man/RPresto-package.Rd: -------------------------------------------------------------------------------- 1 | \name{RPresto-package} 2 | \alias{RPresto-package} 3 | \alias{RPresto} 4 | \docType{package} 5 | \title{Run queries on a Presto server} 6 | \description{PrestoClient provides a method to communicate with a Presto server. Presto is a fast query engine developed by Facebook that runs distributed queries against Hadoop HDFS servers.} 7 | \details{ 8 | \tabular{ll}{ 9 | Package: \tab RPresto\cr 10 | Type: \tab Package\cr 11 | Version: \tab 0.2.1\cr 12 | Date: \tab 2013-12-15\cr 13 | License: \tab Apache License 2.0\cr 14 | Depends: \tab RCurl, jsonlite\cr 15 | } 16 | } 17 | \author{ 18 | Author: Ivo Herweijer\cr 19 | Maintainer: Ivo Herweijer 20 | } 21 | \references{ 22 | http://prestodb.io/\cr 23 | https://github.com/easydatawarehousing/prestoclient\cr 24 | http://www.easydatawarehousing.com/tag/presto/ 25 | } 26 | \keyword{ package } 27 | \seealso{ 28 | } 29 | \examples{ 30 | sql <- "SHOW TABLES" 31 | 32 | # Replace localhost with ip address or dns name of the Presto server running the discovery service 33 | pc <- PrestoClient("localhost") 34 | 35 | if (!pc$startquery(sql) ) { 36 | print(pc$getlasterrormessage() ) 37 | } else { 38 | pc$waituntilfinished(TRUE) # Remove True parameter to skip printing status messages 39 | if (pc$getstatus() == "FAILED") { 40 | print(pc$getlasterrormessage() ) 41 | } 42 | 43 | # We're done now, so let's show the results 44 | pc$getdata() 45 | } 46 | 47 | 48 | # Another way to run a query and return the results as a data.frame is: 49 | sql <- "SHOW TABLES" 50 | pc <- PrestoClient("localhost") 51 | mydf <- pc$runquery(sql) 52 | } 53 | -------------------------------------------------------------------------------- /C/msvc/prestoclient.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | prestoclient\source 6 | 7 | 8 | prestoclient\source 9 | 10 | 11 | prestoclient\source 12 | 13 | 14 | source 15 | 16 | 17 | 18 | 19 | prestoclient\include 20 | 21 | 22 | prestoclient\include 23 | 24 | 25 | 26 | 27 | {da8ec37b-c9e8-456c-89cd-788de38b0ae9} 28 | 29 | 30 | {0c085e01-d3fd-4a18-801f-22be7341cf93} 31 | 32 | 33 | {326c49ef-26db-42e7-94c5-599434e0e456} 34 | 35 | 36 | {2bc57544-019b-4cfd-b0cb-0150d1efc126} 37 | 38 | 39 | -------------------------------------------------------------------------------- /C/prestoclient/prestoclientutils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of cPrestoClient 3 | * 4 | * Copyright (C) 2014 Ivo Herweijer 5 | * 6 | * cPrestoClient is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * You can contact me via email: info@easydatawarehousing.com 20 | */ 21 | 22 | #ifdef _WIN32 23 | #include 24 | #include 25 | 26 | // returnvalue must be freed by caller 27 | char* get_username() 28 | { 29 | DWORD namelength = UNLEN + 1; 30 | CHAR *username = (CHAR*)calloc(UNLEN + 1, sizeof(CHAR) ); 31 | 32 | if (!username) 33 | exit(1); 34 | 35 | GetUserNameA( (CHAR*)username, &namelength); 36 | 37 | return (char*)username; 38 | } 39 | 40 | void util_sleep(const int sleeptime_msec) 41 | { 42 | Sleep(sleeptime_msec); 43 | } 44 | #else 45 | #include 46 | #include 47 | #include 48 | 49 | // returnvalue must be freed by caller 50 | char* get_username() 51 | { 52 | char *username = (char*)calloc(strlen(getenv("USER") ) + 1, sizeof(char) ); 53 | 54 | if (!username) 55 | exit(1); 56 | 57 | strcpy(username, getenv("USER") ); 58 | 59 | return username; 60 | } 61 | 62 | void util_sleep(const int sleeptime_msec) 63 | { 64 | sleep(sleeptime_msec / 1000); 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /C/prestoclient/curl/include/curl/curlver.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURLVER_H 2 | #define __CURL_CURLVER_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* This header file contains nothing but libcurl version info, generated by 26 | a script at release-time. This was made its own header file in 7.11.2 */ 27 | 28 | /* This is the global package copyright */ 29 | #define LIBCURL_COPYRIGHT "1996 - 2013 Daniel Stenberg, ." 30 | 31 | /* This is the version number of the libcurl package from which this header 32 | file origins: */ 33 | #define LIBCURL_VERSION "7.34.0" 34 | 35 | /* The numeric version number is also available "in parts" by using these 36 | defines: */ 37 | #define LIBCURL_VERSION_MAJOR 7 38 | #define LIBCURL_VERSION_MINOR 34 39 | #define LIBCURL_VERSION_PATCH 0 40 | 41 | /* This is the numeric version of the libcurl version number, meant for easier 42 | parsing and comparions by programs. The LIBCURL_VERSION_NUM define will 43 | always follow this syntax: 44 | 45 | 0xXXYYZZ 46 | 47 | Where XX, YY and ZZ are the main version, release and patch numbers in 48 | hexadecimal (using 8 bits each). All three numbers are always represented 49 | using two digits. 1.2 would appear as "0x010200" while version 9.11.7 50 | appears as "0x090b07". 51 | 52 | This 6-digit (24 bits) hexadecimal number does not show pre-release number, 53 | and it is always a greater number in a more recent release. It makes 54 | comparisons with greater than and less than work. 55 | */ 56 | #define LIBCURL_VERSION_NUM 0x072200 57 | 58 | /* 59 | * This is the date and time when the full source package was created. The 60 | * timestamp is not stored in git, as the timestamp is properly set in the 61 | * tarballs by the maketgz script. 62 | * 63 | * The format of the date should follow this template: 64 | * 65 | * "Mon Feb 12 11:35:33 UTC 2007" 66 | */ 67 | #define LIBCURL_TIMESTAMP "Tue Dec 17 07:51:08 UTC 2013" 68 | 69 | #endif /* __CURL_CURLVER_H */ 70 | -------------------------------------------------------------------------------- /C/prestoclient/curl/include/curl/mprintf.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_MPRINTF_H 2 | #define __CURL_MPRINTF_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | #include 26 | #include /* needed for FILE */ 27 | 28 | #include "curl.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | CURL_EXTERN int curl_mprintf(const char *format, ...); 35 | CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); 36 | CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); 37 | CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, 38 | const char *format, ...); 39 | CURL_EXTERN int curl_mvprintf(const char *format, va_list args); 40 | CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); 41 | CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); 42 | CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, 43 | const char *format, va_list args); 44 | CURL_EXTERN char *curl_maprintf(const char *format, ...); 45 | CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); 46 | 47 | #ifdef _MPRINTF_REPLACE 48 | # undef printf 49 | # undef fprintf 50 | # undef sprintf 51 | # undef vsprintf 52 | # undef snprintf 53 | # undef vprintf 54 | # undef vfprintf 55 | # undef vsnprintf 56 | # undef aprintf 57 | # undef vaprintf 58 | # define printf curl_mprintf 59 | # define fprintf curl_mfprintf 60 | #ifdef CURLDEBUG 61 | /* When built with CURLDEBUG we define away the sprintf functions since we 62 | don't want internal code to be using them */ 63 | # define sprintf sprintf_was_used 64 | # define vsprintf vsprintf_was_used 65 | #else 66 | # define sprintf curl_msprintf 67 | # define vsprintf curl_mvsprintf 68 | #endif 69 | # define snprintf curl_msnprintf 70 | # define vprintf curl_mvprintf 71 | # define vfprintf curl_mvfprintf 72 | # define vsnprintf curl_mvsnprintf 73 | # define aprintf curl_maprintf 74 | # define vaprintf curl_mvaprintf 75 | #endif 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __CURL_MPRINTF_H */ 82 | -------------------------------------------------------------------------------- /C/prestoclient/curl/include/curl/easy.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_EASY_H 2 | #define __CURL_EASY_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | CURL_EXTERN CURL *curl_easy_init(void); 29 | CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); 30 | CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); 31 | CURL_EXTERN void curl_easy_cleanup(CURL *curl); 32 | 33 | /* 34 | * NAME curl_easy_getinfo() 35 | * 36 | * DESCRIPTION 37 | * 38 | * Request internal information from the curl session with this function. The 39 | * third argument MUST be a pointer to a long, a pointer to a char * or a 40 | * pointer to a double (as the documentation describes elsewhere). The data 41 | * pointed to will be filled in accordingly and can be relied upon only if the 42 | * function returns CURLE_OK. This function is intended to get used *AFTER* a 43 | * performed transfer, all results from this function are undefined until the 44 | * transfer is completed. 45 | */ 46 | CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); 47 | 48 | 49 | /* 50 | * NAME curl_easy_duphandle() 51 | * 52 | * DESCRIPTION 53 | * 54 | * Creates a new curl session handle with the same options set for the handle 55 | * passed in. Duplicating a handle could only be a matter of cloning data and 56 | * options, internal state info and things like persistent connections cannot 57 | * be transferred. It is useful in multithreaded applications when you can run 58 | * curl_easy_duphandle() for each new thread to avoid a series of identical 59 | * curl_easy_setopt() invokes in every thread. 60 | */ 61 | CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl); 62 | 63 | /* 64 | * NAME curl_easy_reset() 65 | * 66 | * DESCRIPTION 67 | * 68 | * Re-initializes a CURL handle to the default values. This puts back the 69 | * handle to the same state as it was in when it was just created. 70 | * 71 | * It does keep: live connections, the Session ID cache, the DNS cache and the 72 | * cookies. 73 | */ 74 | CURL_EXTERN void curl_easy_reset(CURL *curl); 75 | 76 | /* 77 | * NAME curl_easy_recv() 78 | * 79 | * DESCRIPTION 80 | * 81 | * Receives data from the connected socket. Use after successful 82 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 83 | */ 84 | CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, 85 | size_t *n); 86 | 87 | /* 88 | * NAME curl_easy_send() 89 | * 90 | * DESCRIPTION 91 | * 92 | * Sends data over the connected socket. Use after successful 93 | * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 94 | */ 95 | CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, 96 | size_t buflen, size_t *n); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /python/doc/api-objects.txt: -------------------------------------------------------------------------------- 1 | prestoclient prestoclient-module.html 2 | prestoclient.__package__ prestoclient-module.html#__package__ 3 | prestoclient.PrestoClient prestoclient.PrestoClient-class.html 4 | prestoclient.PrestoClient.__data prestoclient.PrestoClient-class.html#__data 5 | prestoclient.PrestoClient.__timezone prestoclient.PrestoClient-class.html#__timezone 6 | prestoclient.PrestoClient.__columns prestoclient.PrestoClient-class.html#__columns 7 | prestoclient.PrestoClient.getcolumns prestoclient.PrestoClient-class.html#getcolumns 8 | prestoclient.PrestoClient.__updatewaittimemsec prestoclient.PrestoClient-class.html#__updatewaittimemsec 9 | prestoclient.PrestoClient.__useragent prestoclient.PrestoClient-class.html#__useragent 10 | prestoclient.PrestoClient.__lasterror prestoclient.PrestoClient-class.html#__lasterror 11 | prestoclient.PrestoClient.__cancelquery prestoclient.PrestoClient-class.html#__cancelquery 12 | prestoclient.PrestoClient.getlastresponse prestoclient.PrestoClient-class.html#getlastresponse 13 | prestoclient.PrestoClient.__retrievewaittimemsec prestoclient.PrestoClient-class.html#__retrievewaittimemsec 14 | prestoclient.PrestoClient.runquery prestoclient.PrestoClient-class.html#runquery 15 | prestoclient.PrestoClient.getnumberofdatarows prestoclient.PrestoClient-class.html#getnumberofdatarows 16 | prestoclient.PrestoClient.__init__ prestoclient.PrestoClient-class.html#__init__ 17 | prestoclient.PrestoClient.getlastserverstate prestoclient.PrestoClient-class.html#getlastserverstate 18 | prestoclient.PrestoClient.getdata prestoclient.PrestoClient-class.html#getdata 19 | prestoclient.PrestoClient.cleardata prestoclient.PrestoClient-class.html#cleardata 20 | prestoclient.PrestoClient.__maximumretries prestoclient.PrestoClient-class.html#__maximumretries 21 | prestoclient.PrestoClient.getlasterrormessage prestoclient.PrestoClient-class.html#getlasterrormessage 22 | prestoclient.PrestoClient.__cancel prestoclient.PrestoClient-class.html#__cancel 23 | prestoclient.PrestoClient.queryisrunning prestoclient.PrestoClient-class.html#queryisrunning 24 | prestoclient.PrestoClient.__retrywaittimemsec prestoclient.PrestoClient-class.html#__retrywaittimemsec 25 | prestoclient.PrestoClient.getqueryinfo prestoclient.PrestoClient-class.html#getqueryinfo 26 | prestoclient.PrestoClient.__lastinfouri prestoclient.PrestoClient-class.html#__lastinfouri 27 | prestoclient.PrestoClient.startquery prestoclient.PrestoClient-class.html#startquery 28 | prestoclient.PrestoClient.__server prestoclient.PrestoClient-class.html#__server 29 | prestoclient.PrestoClient.__version prestoclient.PrestoClient-class.html#__version 30 | prestoclient.PrestoClient.cancelquery prestoclient.PrestoClient-class.html#cancelquery 31 | prestoclient.PrestoClient.__laststate prestoclient.PrestoClient-class.html#__laststate 32 | prestoclient.PrestoClient.__openuri prestoclient.PrestoClient-class.html#__openuri 33 | prestoclient.PrestoClient.__urltimeout prestoclient.PrestoClient-class.html#__urltimeout 34 | prestoclient.PrestoClient.__catalog prestoclient.PrestoClient-class.html#__catalog 35 | prestoclient.PrestoClient.__lastnexturi prestoclient.PrestoClient-class.html#__lastnexturi 36 | prestoclient.PrestoClient.__lastcanceluri prestoclient.PrestoClient-class.html#__lastcanceluri 37 | prestoclient.PrestoClient.__lastresponse prestoclient.PrestoClient-class.html#__lastresponse 38 | prestoclient.PrestoClient.getstatus prestoclient.PrestoClient-class.html#getstatus 39 | prestoclient.PrestoClient.__port prestoclient.PrestoClient-class.html#__port 40 | prestoclient.PrestoClient.__clientstatus prestoclient.PrestoClient-class.html#__clientstatus 41 | prestoclient.PrestoClient.__getvarsfromresponse prestoclient.PrestoClient-class.html#__getvarsfromresponse 42 | prestoclient.PrestoClient.waituntilfinished prestoclient.PrestoClient-class.html#waituntilfinished 43 | prestoclient.PrestoClient.__user prestoclient.PrestoClient-class.html#__user 44 | prestoclient.PrestoClient.__language prestoclient.PrestoClient-class.html#__language 45 | prestoclient.PrestoClient.__source prestoclient.PrestoClient-class.html#__source 46 | prestoclient.PrestoClient.getversion prestoclient.PrestoClient-class.html#getversion 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PrestoClient 2 | ============ 3 | 4 | PrestoClient implements the client protocol to communicate with a Presto server. 5 | Presto [prestodb.io](http://prestodb.io/) is a fast query engine developed 6 | by Facebook that runs distributed queries against a (cluster of) 7 | Hadoop HDFS servers [Hadoop](http://hadoop.apache.org/). 8 | Presto uses SQL as its query language. Presto is an alternative for 9 | Hadoop-Hive. 10 | 11 | Versions 12 | -------- 13 | PrestoClient currently supports these versions: 14 | 15 | - Python 16 | - R language (deprecated, use the [DBI client](https://github.com/prestodb/RPresto)) 17 | - C 18 | 19 | Comparison 20 | ---------- 21 | I gathered some statistics on performance and memory use of different versions (in a non-scientific 22 | way by using time and ps). Results are from querying data from one table and writing this in CSV 23 | format to stdout. The resulting csv file would be about 20Mb (but piped into /dev/null). 24 | The average best times are shown here: 25 | 26 | | Version | runtime (sec) | memory (Mb) | 27 | | ---------- | -------------:| -----------:| 28 | | Java (CLI) | 10.5 | 150 | 29 | | Python | 9.7 | 300 | 30 | | C | 5.3 | 1 | 31 | 32 | Note that the memory usage of the C version is so low because the query data is not stored, only passed 33 | through. 34 | 35 | Presto client protocol 36 | ---------------------- 37 | The communication protocol used between Presto clients and servers is not documented yet. It seems to 38 | be as follows: 39 | 40 | Client sends http POST request to the Presto server, page: "/v1/statement". Header information should 41 | include: X-Presto-Catalog, X-Presto-Source, X-Presto-Schema, User-Agent, X-Presto-User. The body of the 42 | request should contain the sql statement. The server responds by returning JSON data (http status-code 200). 43 | This reply may contain up to 3 uri's. One giving the link to get more information about the query execution 44 | ('infoUri'), another giving the link to fetch the next packet of data ('nextUri') and one with the uri to 45 | cancel the query ('partialCancelUri'). 46 | 47 | The client should send GET requests to the server (Header: X-Presto-Source, User-Agent, X-Presto-User. 48 | Body: empty) following the 'nextUri' link from the previous response until the servers response does not 49 | contain an 'nextUri' link anymore. When there is no 'nextUri' the query is finished. If the last response 50 | from the server included an error section ('error') the query failed, otherwise the query succeeded. If 51 | the http status of the server response is anything other than 200 with Content-Type application/json, the 52 | query should also be considered failed. A 503 http response means that the server is (too) busy. Retry the 53 | request after waiting at least 50ms. 54 | The server response may contain a 'state' variable. This is for informational purposes only (may be subject 55 | to change in future implementations). 56 | Each response by the server to a 'nextUri' may contain information about the columns returned by the query 57 | and all- or part of the querydata. If the response contains a data section the columns section will always 58 | be available. 59 | 60 | The server reponse may contain a variable with the uri to cancel the query ('partialCancelUri'). The client 61 | may issue a DELETE request to the server using this link. Response http status-code is 204. 62 | 63 | The Presto server will retain information about finished queries for 15 minutes. When a client does not 64 | respond to the server (by following the 'nextUri' links) the server will cancel these 'dead' queries after 65 | 5 minutes. These timeouts are hardcoded in the Presto server source code. 66 | 67 | Availability 68 | ------------ 69 | Source code is available through: https://github.com/easydatawarehousing/prestoclient 70 | Additional information may be found here: http://www.easydatawarehousing.com/tag/presto/ 71 | 72 | Copyright 73 | --------- 74 | Copyright 2013-2014 Ivo Herweijer | easydatawarehousing.com 75 | 76 | License 77 | ------- 78 | Most versions are licensed under Apache 2.0. The C version uses the GPLv3 license. 79 | -------------------------------------------------------------------------------- /python/doc/module-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Module Hierarchy 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 50 | 51 |
  40 | 41 | 42 | 44 | 48 |
[hide private]
[frames] | no frames]
49 |
52 |
53 | [ Module Hierarchy 54 | | Class Hierarchy ] 55 |

56 |

Module Hierarchy

57 |
    58 |
  • prestoclient: PrestoClient provides a method to communicate with a Presto server.
  • 59 |
60 | 61 | 63 | 64 | 65 | 67 | 68 | 69 | 71 | 72 | 73 | 75 | 76 | 77 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 88 | 92 | 93 |
94 | 95 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /python/doc/class-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 50 | 51 |
  40 | 41 | 42 | 44 | 48 |
[hide private]
[frames] | no frames]
49 |
52 |
53 | [ Module Hierarchy 54 | | Class Hierarchy ] 55 |

56 |

Class Hierarchy

57 |
    58 |
  • prestoclient.PrestoClient: 59 | PrestoClient implements a Python class to communicate with a Presto 60 | server. 61 |
  • 62 |
63 | 64 | 66 | 67 | 68 | 70 | 71 | 72 | 74 | 75 | 76 | 78 | 79 | 80 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 95 | 96 |
97 | 98 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /C/msvc/prestoclient.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {232CA226-328A-4650-A0F0-A0BACAD8680A} 15 | prestoclient 16 | cprestoclient 17 | 18 | 19 | 20 | Application 21 | true 22 | MultiByte 23 | 24 | 25 | Application 26 | false 27 | true 28 | MultiByte 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Level4 44 | Disabled 45 | ..\include;..\prestoclient\;..\prestoclient\curl\include 46 | 4706;4996 47 | EditAndContinue 48 | DEBUG;%(PreprocessorDefinitions) 49 | 50 | 51 | true 52 | ..\prestoclient\curl\lib\Debug 53 | libcurl.lib;%(AdditionalDependencies) 54 | 55 | 56 | 57 | 58 | Level3 59 | MaxSpeed 60 | true 61 | true 62 | ..\include;..\prestoclient\;..\prestoclient\curl\include 63 | 4706;4996 64 | 65 | 66 | true 67 | true 68 | true 69 | libcurl.lib;%(AdditionalDependencies) 70 | ..\prestoclient\curl\lib\Release 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /RPresto/README: -------------------------------------------------------------------------------- 1 | This component of Prestoclient is deprecated and no longer maintained! 2 | ====================================================================== 3 | 4 | Please use the DBI client: https://github.com/prestodb/RPresto 5 | -------------------------------------------------------------- 6 | 7 | PrestoClient for R 8 | ================== 9 | 10 | PrestoClient implements a method to communicate with a Presto server. Presto (http://prestodb.io/) is a fast query engine developed by Facebook that runs distributed queries against a (cluster of) Hadoop HDFS servers (http://hadoop.apache.org/).\cr 11 | Presto uses SQL as its query language. Presto is an alternative for Hadoop-Hive.\cr 12 | PrestoClient was developed and tested on Presto 0.54. R version used: 3.0.2, RCurl: 1.95-4.1, jsonlite: 0.9.1 13 | 14 | You can use this class with this sample code: 15 | 16 | sql <- "SHOW TABLES" 17 | 18 | # Replace localhost with ip address or dns name of the Presto server running the discovery service 19 | pc <- PrestoClient("localhost") 20 | 21 | if (!pc$startquery(sql) ) { 22 | print(pc$getlasterrormessage() ) 23 | } else { 24 | pc$waituntilfinished(TRUE) # Remove True parameter to skip printing status messages 25 | if (pc$getstatus() == "FAILED") { 26 | print(pc$getlasterrormessage() ) 27 | } 28 | 29 | # We're done now, so let's show the results 30 | pc$getdata() 31 | } 32 | 33 | 34 | Presto client protocol 35 | ---------------------- 36 | The communication protocol used between Presto clients and servers is not documented yet. It seems to 37 | be as follows: 38 | 39 | Client sends http POST request to the Presto server, page: "/v1/statement". Header information should 40 | include: X-Presto-Catalog, X-Presto-Source, X-Presto-Schema, User-Agent, X-Presto-User. The body of the 41 | request should contain the sql statement. The server responds by returning JSON data (http status-code 200). 42 | This reply may contain up to 3 uri's. One giving the link to get more information about the query execution 43 | ('infoUri'), another giving the link to fetch the next packet of data ('nextUri') and one with the uri to 44 | cancel the query ('partialCancelUri'). 45 | 46 | The client should send GET requests to the server (Header: X-Presto-Source, User-Agent, X-Presto-User. 47 | Body: empty) following the 'nextUri' link from the previous response until the servers response does not 48 | contain an 'nextUri' link anymore. When there is no 'nextUri' the query is finished. If the last response 49 | from the server included an error section ('error') the query failed, otherwise the query succeeded. If 50 | the http status of the server response is anything other than 200 with Content-Type application/json, the 51 | query should also be considered failed. A 503 http response means that the server is (too) busy. Retry the 52 | request after waiting at least 50ms. 53 | The server response may contain a 'state' variable. This is for informational purposes only (may be subject 54 | to change in future implementations). 55 | Each response by the server to a 'nextUri' may contain information about the columns returned by the query 56 | and all- or part of the querydata. If the response contains a data section the columns section will always 57 | be available. 58 | 59 | The server reponse may contain a variable with the uri to cancel the query ('partialCancelUri'). The client 60 | may issue a DELETE request to the server using this link. Response http status-code is 204. 61 | 62 | The Presto server will retain information about finished queries for 15 minutes. When a client does not 63 | respond to the server (by following the 'nextUri' links) the server will cancel these 'dead' queries after 64 | 5 minutes. These timeouts are hardcoded in the Presto server source code. 65 | 66 | ToDo 67 | ---- 68 | - The R version of PrestoClient is quite slow, due to the cbind operations. May be useful to switch to the 69 | C version in the future. 70 | - Enable PrestoClient to handle multiple running queries simultaneously. Currently you can only run one 71 | query per instance of this class. 72 | - Add support for https connections 73 | - Add support for insert/update queries (if and when Presto server supports this). 74 | 75 | Availability 76 | ------------ 77 | Source code is available through: https://github.com/easydatawarehousing/prestoclient 78 | 79 | Additional information may be found here: http://www.easydatawarehousing.com/tag/presto/ 80 | 81 | Copyright 82 | --------- 83 | Copyright 2013 Ivo Herweijer | easydatawarehousing.com 84 | 85 | Licensed under the Apache License, Version 2.0 (the "License"); 86 | you may not use this file except in compliance with the License. 87 | You may obtain a copy of the License at: 88 | 89 | http://www.apache.org/licenses/LICENSE-2.0 90 | 91 | Unless required by applicable law or agreed to in writing, software 92 | distributed under the License is distributed on an "AS IS" BASIS, 93 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 94 | See the License for the specific language governing permissions and 95 | limitations under the License. 96 | -------------------------------------------------------------------------------- /C/README.md: -------------------------------------------------------------------------------- 1 | cPrestoClient 2 | ============= 3 | 4 | cPrestoClient implements the client protocol to communicate with a Presto server. 5 | 6 | Presto (http://prestodb.io/) is a fast query engine developed 7 | by Facebook that runs distributed queries against a (cluster of) 8 | Hadoop HDFS servers (http://hadoop.apache.org/). 9 | Presto uses SQL as its query language and is an alternative for Hadoop-Hive. 10 | 11 | Features 12 | -------- 13 | - Written in fast C code 14 | - Only streaming data, so no big buffers to hold data 15 | - Fully UTF-8 compliant 16 | 17 | Installation 18 | ------------ 19 | The only external dependancy of cPrestoClient is LibCurl. This is installed on most 20 | Linux/Debian systems by default. As a convenience, the curl header files are included 21 | in this download (version 7.34). 22 | 23 | On Linux/Debian use these commands: 24 | 25 | git clone https://github.com/easydatawarehousing/prestoclient.git 26 | cd prestoclient/C 27 | cmake . 28 | make 29 | 30 | Optionally you can make changes to CMakeLists.txt and run cmake 31 | 32 | On Windows, using Visual Studio: 33 | - Download and unzip: https://github.com/easydatawarehousing/prestoclient/archive/master.zip 34 | - Open prestoclient/C/msvc/prestoclient.sln 35 | - Download an appropriate version of cURL: http://curl.haxx.se/download.html 36 | Copy the debug version of libcurl.dll to: ./C/msvc/Debug 37 | and libcurl.lib files to: ./C/prestoclient/curl/lib/Debug 38 | Do the same for the release versions, but to the Release folders. 39 | 40 | Usage 41 | ----- 42 | Included in this download is file main.c, this may be used as an example of how to use the C interface 43 | defined in prestoclient.h 44 | 45 | Basically it implements a commandline utility that takes an sql statement and dumps the results 46 | of that query as comma separated text to stdout. 47 | 48 | Execute with: 49 | cprestoclient "servername" "sql-statement" 50 | 51 | ToDo 52 | ---- 53 | - Implementation of Presto client protocol should be stable 54 | - Add a callback function to recieve status/progress messages while the query is running 55 | - Add functions that handle datatype conversion (string to boolean/long/double) 56 | - This C implementation is meant to be used in other software that needs fast communication with 57 | a Presto server. Planned is a rewrite of the R version (current version also in this download). 58 | This client will also be used in the Easy-To-Oracle suite of database connect tools. See: 59 | http://www.easydatawarehousing.com/easy-to-oracle-free-open-source-data-integration-for-oracle-databases/ 60 | 61 | 62 | Presto client protocol 63 | ---------------------- 64 | The communication protocol used between Presto clients and servers is not documented yet. It seems to 65 | be as follows: 66 | 67 | Client sends http POST request to the Presto server, page: "/v1/statement". Header information should 68 | include: X-Presto-Catalog, X-Presto-Source, X-Presto-Schema, User-Agent, X-Presto-User. The body of the 69 | request should contain the sql statement. The server responds by returning JSON data (http status-code 200). 70 | This reply may contain up to 3 uri's. One giving the link to get more information about the query execution 71 | ('infoUri'), another giving the link to fetch the next packet of data ('nextUri') and one with the uri to 72 | cancel the query ('partialCancelUri'). 73 | 74 | The client should send GET requests to the server (Header: X-Presto-Source, User-Agent, X-Presto-User. 75 | Body: empty) following the 'nextUri' link from the previous response until the servers response does not 76 | contain an 'nextUri' link anymore. When there is no 'nextUri' the query is finished. If the last response 77 | from the server included an error section ('error') the query failed, otherwise the query succeeded. If 78 | the http status of the server response is anything other than 200 with Content-Type application/json, the 79 | query should also be considered failed. A 503 http response means that the server is (too) busy. Retry the 80 | request after waiting at least 50ms. 81 | The server response may contain a 'state' variable. This is for informational purposes only (may be subject 82 | to change in future implementations). 83 | Each response by the server to a 'nextUri' may contain information about the columns returned by the query 84 | and all- or part of the querydata. If the response contains a data section the columns section will always 85 | be available. 86 | 87 | The server reponse may contain a variable with the uri to cancel the query ('partialCancelUri'). The client 88 | may issue a DELETE request to the server using this link. Response http status-code is 204. 89 | 90 | The Presto server will retain information about finished queries for 15 minutes. When a client does not 91 | respond to the server (by following the 'nextUri' links) the server will cancel these 'dead' queries after 92 | 5 minutes. These timeouts are hardcoded in the Presto server source code. 93 | 94 | Availability 95 | ------------ 96 | Source code is available through: https://github.com/easydatawarehousing/prestoclient 97 | 98 | Additional information may be found here: http://www.easydatawarehousing.com/tag/presto/ 99 | 100 | Copyright 101 | --------- 102 | Copyright 2013-2014 Ivo Herweijer | easydatawarehousing.com 103 | 104 | Licensed under the GPLv3 license. Optionally a commercial license is available. 105 | (See: http://www.easydatawarehousing.com) 106 | -------------------------------------------------------------------------------- /RPresto/man/PrestoClient-class.Rd: -------------------------------------------------------------------------------- 1 | \name{PrestoClient-class} 2 | \Rdversion{1.1} 3 | \docType{class} 4 | \alias{PrestoClient-class} 5 | \alias{PrestoClient} 6 | \title{Class \code{"PrestoClient"}} 7 | \description{ 8 | PrestoClient implements a method to communicate with a Presto server. Presto (http://prestodb.io/) is a fast query engine developed by Facebook that runs distributed queries against a (cluster of) Hadoop HDFS servers (http://hadoop.apache.org/).\cr 9 | Presto uses SQL as its query language. Presto is an alternative for Hadoop-Hive.\cr 10 | PrestoClient was developed and tested on Presto 0.54. R version used: 3.0.2, RCurl: 1.95-4.1, jsonlite: 0.9.1 11 | } 12 | \section{Extends}{ 13 | All reference classes extend and inherit methods from \code{"\linkS4class{envRefClass}"}. 14 | } 15 | \references{ 16 | http://prestodb.io/\cr 17 | https://github.com/easydatawarehousing/prestoclient\cr 18 | http://www.easydatawarehousing.com/tag/presto/ 19 | } 20 | \author{ 21 | Author: Ivo Herweijer 22 | } 23 | \note{ 24 | } 25 | \seealso{ 26 | } 27 | \examples{ 28 | sql <- "SHOW TABLES" 29 | 30 | # Replace localhost with ip address or dns name of the Presto server running the discovery service 31 | pc <- PrestoClient("localhost") 32 | 33 | if (!pc$startquery(sql) ) { 34 | print(pc$getlasterrormessage() ) 35 | } else { 36 | pc$waituntilfinished(TRUE) # Remove True parameter to skip printing status messages 37 | if (pc$getstatus() == "FAILED") { 38 | print(pc$getlasterrormessage() ) 39 | } 40 | 41 | # We're done now, so let's show the results 42 | pc$getdata() 43 | } 44 | 45 | 46 | # Another way to run a query and return the results as a data.frame is: 47 | sql <- "SHOW TABLES" 48 | pc <- PrestoClient("localhost") 49 | mydf <- pc$runquery(sql) 50 | } 51 | \keyword{classes} 52 | \section{Fields}{ 53 | All member variables are private and should not be used directly. Use the get- methods to retrieve important values. 54 | } 55 | \section{Methods}{ 56 | \describe{ 57 | \item{\code{getversion()}:}{ Return PrestoClient version number. } 58 | \item{\code{initialize(inServer, inPort, inCatalog, inUser)}:}{ Constructor of PrestoClient class.\cr\cr 59 | Arguments:\cr 60 | inServer -- IP Address or dns name of the Presto server running the discovery service\cr 61 | inPort -- TCP port of the Prestoserver running the discovery service (default 8080)\cr 62 | inCatalog -- Catalog name that the Prestoserver should use to query hdfs (default 'hive')\cr 63 | inUser -- Username to pass to the Prestoserver. If left blank the username from the OS is used (default '') } 64 | \item{\code{runquery(inSqlStatement, inSchema, inVerbose)}:}{ Convenience function to start a query and wait till it is finished and return the data. Currently, only one simultaneous query per instance of the PrestoClient class is allowed.\cr 65 | Starting a new query will discard any data previously retrieved !\cr\cr 66 | Arguments:\cr 67 | inSqlStatement -- The query that should be executed by the Presto server\cr 68 | inSchema -- The HDFS schema that should be used (default 'default')\cr 69 | inVerbose -- If True print some simple progress messages (default False) } 70 | \item{\code{startquery(inSqlStatement, inSchema)}:}{ Start a query. Currently, only one simultaneous query per instance of the PrestoClient class is allowed.\cr 71 | Starting a new query will discard any data previously retrieved !\cr\cr 72 | Arguments:\cr 73 | inSqlStatement -- The query that should be executed by the Presto server\cr 74 | inSchema -- The HDFS schema that should be used (default 'default')\cr\cr 75 | Returns TRUE if call succeeded. } 76 | \item{\code{waituntilfinished(inVerbose)}:}{ Returns when query has finished. Override this function to implement your own data retrieval setup.\cr 77 | For instance to run this function in a separate thread so other threads may request a cancellation.\cr\cr 78 | Arguments:\cr 79 | inVerbose -- If True print some simple progress messages (default False) } 80 | \item{\code{queryisrunning()}:}{ Returns TRUE if query is running. } 81 | \item{\code{cancelquery()}:}{ Inform Prestoclient to cancel the running query. When queryisrunning() is called prestoclient will send a cancel query request to the Presto server. } 82 | \item{\code{getqueryinfo()}:}{ Requests query information from the Presto server and returns this as a dictonary. The Presto server removes this information 15 minutes after finishing the query. } 83 | \item{\code{cleardata()}:}{ Empty the data buffer. You can use this function to implement your own 'streaming' data retrieval setup. } 84 | \item{\code{getdata()}:}{ Return the currently buffered data as a data.frame } 85 | \item{\code{getnumberofdatarows()}:}{ Return the length of the currently buffered data in number of rows. } 86 | \item{\code{getcolumns()}:}{ Return the column information of the queryresults. data.frame of datatype / fieldname. } 87 | \item{\code{getlasterrormessage()}:}{ Return error message of last executed request to the prestoserver or empty string if there is no error. } 88 | \item{\code{getlastserverstate()}:}{ Return state of the request as reported by the Presto server. } 89 | \item{\code{getstatus()}:}{ Return status of the client. Note this is not the same as the state reported by the Presto server! } 90 | \item{\code{getlastresponse()}:}{ Return response of last executed request to the prestoserver. } 91 | \item{\code{openuri(inUri, inSimplifyDF)}:}{ Internal function: sends a GET request to the Presto server. } 92 | \item{\code{getvarsfromresponse()}:}{ Internal function: retrieves some information from the response of the Presto server. Keeps the last known values, except for 'nextUri'. } 93 | \item{\code{updatedatatypes()}:}{ Internal function: changes datatype of query data to that specified by the columns info. } 94 | \item{\code{cancel()}:}{ Internal function: sends a cancel request to the Prestoserver. } 95 | } 96 | } -------------------------------------------------------------------------------- /C/src/main.c: -------------------------------------------------------------------------------- 1 | /* This file is part of Easy to Oracle - Free Open Source Data Integration 2 | * 3 | * Copyright (C) 2014 Ivo Herweijer 4 | * 5 | * Easy to Oracle is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | * 18 | * You can contact me via email: info@easydatawarehousing.com 19 | */ 20 | 21 | #include "prestoclient.h" 22 | #include 23 | #include 24 | #include 25 | 26 | #ifndef bool 27 | #define bool signed char 28 | #define true 1 29 | #define false 0 30 | #endif 31 | 32 | /* 33 | * Define a struct to hold the data for a client session. A pointer 34 | * to this struct will be passed in all callback functions. This 35 | * enables you to handle multiple queries simultaneously. 36 | */ 37 | typedef struct ST_QUERYDATA 38 | { 39 | bool hdr_printed; 40 | char *cache; 41 | unsigned int cache_size; 42 | } QUERYDATA; 43 | 44 | /* 45 | * The descibe callback function. This function will be called when the 46 | * column description data becomes available. You can use it to print header 47 | * information or examine column type info. 48 | */ 49 | static void describe_callback_function(void *in_querydata, void *in_result) 50 | { 51 | QUERYDATA *qdata = (QUERYDATA*)in_querydata; 52 | PRESTOCLIENT_RESULT *result = (PRESTOCLIENT_RESULT*)in_result; 53 | unsigned int i, columncount = prestoclient_getcolumncount(result); 54 | 55 | if (!qdata->hdr_printed && columncount > 0) 56 | { 57 | /* 58 | * Print header row 59 | */ 60 | for (i = 0; i < columncount; i++) 61 | printf("%s%s", i > 0 ? ";" : "", prestoclient_getcolumnname(result, i) ); 62 | 63 | printf("\n"); 64 | 65 | /* 66 | * Print datatype of each column 67 | */ 68 | for (i = 0; i < columncount; i++) 69 | printf("%s%s", i > 0 ? ";" : "", prestoclient_getcolumntypedescription(result, i) ); 70 | 71 | printf("\n"); 72 | 73 | /* 74 | * Mark header as printed 75 | */ 76 | qdata->hdr_printed = true; 77 | } 78 | } 79 | 80 | /* 81 | * The write callback function. This function will be called for every row of 82 | * query data. 83 | */ 84 | static void write_callback_function(void *in_querydata, void *in_result) 85 | { 86 | QUERYDATA *qdata = (QUERYDATA*)in_querydata; 87 | PRESTOCLIENT_RESULT *result = (PRESTOCLIENT_RESULT*)in_result; 88 | unsigned int i, newdatalen, columncount = prestoclient_getcolumncount(result); 89 | 90 | /* 91 | * Output one data row 92 | */ 93 | for (i = 0; i < columncount; i++) 94 | { 95 | /* 96 | * Check cache size first 97 | */ 98 | newdatalen = strlen(prestoclient_getcolumndata(result, i) ); 99 | 100 | if (qdata->cache_size < strlen(qdata->cache) + newdatalen + 3) 101 | { 102 | /* 103 | * Add memory block of 1 Kb to cache 104 | */ 105 | qdata->cache_size = ( (qdata->cache_size + newdatalen + 1027) / 1024) * 1024; 106 | qdata->cache = (char*)realloc( (char*)qdata->cache, qdata->cache_size); 107 | if (!qdata->cache) 108 | exit(1); 109 | } 110 | 111 | /* 112 | * Add field value as string, prestoclient doesn't do any type conversions (yet) 113 | */ 114 | strcat(qdata->cache, prestoclient_getcolumndata(result, i) ); 115 | 116 | /* 117 | * You can use prestoclient_getnullcolumnvalue here 118 | * to test if value is NULL in the database 119 | */ 120 | 121 | /* 122 | * Add a field separator 123 | */ 124 | if (i < columncount - 1) 125 | strcat(qdata->cache, ";"); 126 | } 127 | 128 | /* 129 | * Print rowdata and a row separator 130 | */ 131 | printf("%s\n", qdata->cache); 132 | 133 | /* 134 | * Clear cache 135 | */ 136 | qdata->cache[0] = 0; 137 | } 138 | 139 | /* 140 | * Min function for a simple commandline application. 141 | */ 142 | int main(int argc, char **argv) 143 | { 144 | QUERYDATA *qdata; 145 | PRESTOCLIENT *pc; 146 | PRESTOCLIENT_RESULT *result; 147 | bool status = false; 148 | 149 | /* 150 | * Read commandline parameters 151 | */ 152 | if (argc < 3) 153 | { 154 | printf("Usage: cprestoclient \n"); 155 | printf("Example:\ncprestoclient localhost \"select * from sample_07\"\n"); 156 | exit(1); 157 | } 158 | 159 | /* 160 | * Set up data 161 | */ 162 | qdata = (QUERYDATA*)malloc( sizeof(QUERYDATA) ); 163 | qdata->hdr_printed = false; 164 | qdata->cache_size = 1; 165 | qdata->cache = (char*)malloc(qdata->cache_size); 166 | qdata->cache[0] = 0; 167 | 168 | /* 169 | * Initialize prestoclient. We're using default values for everything but the servername 170 | */ 171 | pc = prestoclient_init(argv[1], NULL, NULL, NULL, NULL, NULL, NULL); 172 | 173 | if (!pc) 174 | { 175 | printf("Could not initialize prestoclient\n"); 176 | } 177 | else 178 | { 179 | /* 180 | * Execute query 181 | */ 182 | result = prestoclient_query(pc, argv[2], NULL, &write_callback_function, &describe_callback_function, (void*)qdata); 183 | 184 | if (!result) 185 | { 186 | printf("Could not start query '%s' on server '%s'\n", argv[2], argv[1]); 187 | } 188 | else 189 | { 190 | /* 191 | * Check results 192 | */ 193 | if (result) 194 | { 195 | /* 196 | * Query succeeded ? 197 | */ 198 | status = prestoclient_getstatus(result) == PRESTOCLIENT_STATUS_SUCCEEDED; 199 | 200 | /* 201 | * Messages from presto server 202 | */ 203 | if (prestoclient_getlastservererror(result) ) 204 | { 205 | printf("%s\n", prestoclient_getlastservererror(result) ); 206 | printf("Serverstate = %s\n", prestoclient_getlastserverstate(result) ); 207 | } 208 | 209 | /* 210 | * Messages from prestoclient 211 | */ 212 | if (prestoclient_getlastclienterror(result) ) 213 | { 214 | printf("%s\n", prestoclient_getlastclienterror(result) ); 215 | } 216 | 217 | /* 218 | * Messages from curl 219 | */ 220 | if (prestoclient_getlastcurlerror(result) ) 221 | { 222 | printf("%s\n", prestoclient_getlastcurlerror(result) ); 223 | } 224 | } 225 | } 226 | } 227 | 228 | /* 229 | * Cleanup 230 | */ 231 | prestoclient_close(pc); 232 | 233 | if (qdata && qdata->cache) 234 | free(qdata->cache); 235 | 236 | if (qdata) 237 | free(qdata); 238 | 239 | return (status ? 0 : 1); 240 | } 241 | -------------------------------------------------------------------------------- /python/doc/prestoclient-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | prestoclient 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 43 | 54 | 55 |
39 | 40 | Module prestoclient 41 | 42 | 44 | 45 | 46 | 48 | 52 |
[hide private]
[frames] | no frames]
53 |
56 | 57 |

Module prestoclient

source code

58 |

PrestoClient provides a method to communicate with a Presto server. 59 | Presto is a fast query engine developed by Facebook that runs distributed 60 | queries against Hadoop HDFS servers.

61 |

Copyright 2013-2014 Ivo Herweijer | easydatawarehousing.com

62 |

Licensed under the Apache License, Version 2.0 (the 63 | "License"); you may not use this file except in compliance with 64 | the License. You may obtain a copy of the License at:

65 |

http://www.apache.org/licenses/LICENSE-2.0

66 |

Unless required by applicable law or agreed to in writing, software 67 | distributed under the License is distributed on an "AS IS" 68 | BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 69 | implied. See the License for the specific language governing permissions 70 | and limitations under the License.

71 | 72 | 73 | 74 | 76 | 77 | 88 | 89 | 90 | 97 | 98 |
78 | 79 | 80 | 81 | 85 | 86 |
Classes[hide private]
87 |
91 |   92 | 93 | PrestoClient
94 | PrestoClient implements a Python class to communicate with a Presto 95 | server. 96 |
99 | 100 | 101 | 103 | 104 | 115 | 116 | 117 | 122 | 123 |
105 | 106 | 107 | 108 | 112 | 113 |
Variables[hide private]
114 |
118 |   119 | 120 | __package__ = None 121 |
124 | 125 | 127 | 128 | 129 | 131 | 132 | 133 | 135 | 136 | 137 | 139 | 140 | 141 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 152 | 156 | 157 |
158 | 159 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /C/prestoclient/prestoclienttypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of cPrestoClient 3 | * 4 | * Copyright (C) 2014 Ivo Herweijer 5 | * 6 | * cPrestoClient is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * You can contact me via email: info@easydatawarehousing.com 20 | */ 21 | 22 | // Do not include this file in your project 23 | // These are private defines and type declarations for prestoclient 24 | // Use "prestoclient.h" instead 25 | 26 | #ifndef EASYPTORA_PRESTOCLIENTTYPES_HH 27 | #define EASYPTORA_PRESTOCLIENTTYPES_HH 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | /* --- Defines -------------------------------------------------------------------------------------------------------- */ 35 | #define PRESTOCLIENT_QUERY_URL "/v1/statement"; // URL added to servername to start a query 36 | #define PRESTOCLIENT_CURL_BUFFERSIZE CURL_MAX_WRITE_SIZE; // (Preferred) Bufferzize for communication with curl 37 | #define PRESTOCLIENT_CURL_EXPECT_HTTP_GET_POST 200; // Expected http response code for get and post requests 38 | #define PRESTOCLIENT_CURL_EXPECT_HTTP_DELETE 204; // Expected http response code for delete requests 39 | #define PRESTOCLIENT_CURL_EXPECT_HTTP_BUSY 503; // Expected http response code when presto server is busy 40 | 41 | /* --- Enums ---------------------------------------------------------------------------------------------------------- */ 42 | enum E_RESULTCODES 43 | { 44 | PRESTOCLIENT_RESULT_OK = 0, 45 | PRESTOCLIENT_RESULT_BAD_REQUEST_DATA, 46 | PRESTOCLIENT_RESULT_SERVER_ERROR, 47 | PRESTOCLIENT_RESULT_MAX_RETRIES_REACHED, 48 | PRESTOCLIENT_RESULT_CURL_ERROR, 49 | PRESTOCLIENT_RESULT_PARSE_JSON_ERROR 50 | }; 51 | 52 | enum E_HTTP_REQUEST_TYPES 53 | { 54 | PRESTOCLIENT_HTTP_REQUEST_TYPE_GET, 55 | PRESTOCLIENT_HTTP_REQUEST_TYPE_POST, 56 | PRESTOCLIENT_HTTP_REQUEST_TYPE_DELETE 57 | }; 58 | 59 | enum E_JSON_READSTATES 60 | { 61 | JSON_RS_SEARCH_OBJECT = 0 62 | , JSON_RS_READ_STRING 63 | , JSON_RS_READ_NONSTRING 64 | }; 65 | 66 | enum E_JSON_CONTROL_CHARS 67 | { 68 | JSON_CC_NONE = 0 69 | , JSON_CC_WS // Whitespace (space, tab, line feed, form feed, carriage return) 70 | , JSON_CC_OO // Object open { 71 | , JSON_CC_OC // Object close } 72 | , JSON_CC_AO // Array open [ 73 | , JSON_CC_AC // Array close ] 74 | , JSON_CC_BS // Backslash 75 | , JSON_CC_QT // Double quote 76 | , JSON_CC_COLON // Colon 77 | , JSON_CC_COMMA // Comma 78 | }; 79 | 80 | enum E_JSON_TAGTYPES 81 | { 82 | JSON_TT_UNKNOWN = 0 83 | , JSON_TT_STRING 84 | , JSON_TT_NUMBER 85 | , JSON_TT_OBJECT_OPEN 86 | , JSON_TT_OBJECT_CLOSE 87 | , JSON_TT_ARRAY_OPEN 88 | , JSON_TT_ARRAY_CLOSE 89 | , JSON_TT_COLON 90 | , JSON_TT_COMMA 91 | , JSON_TT_TRUE 92 | , JSON_TT_FALSE 93 | , JSON_TT_NULL 94 | }; 95 | 96 | /* --- Typedefs ------------------------------------------------------------------------------------------------------- */ 97 | #ifndef bool 98 | #define bool signed char 99 | #define true 1 100 | #define false 0 101 | #endif 102 | 103 | /* --- Structs -------------------------------------------------------------------------------------------------------- */ 104 | typedef struct ST_JSONPARSER 105 | { 106 | enum E_JSON_READSTATES state; // State of state-machine 107 | bool isbackslash; // If true, the previous character was a BS 108 | unsigned int readposition; // Readposition within curl buffer 109 | bool skipnextread; // If true don't read the next character, keep the current character 110 | bool error; // Set to true when a parse error is detected 111 | char *c; // Current character 112 | enum E_JSON_CONTROL_CHARS control; // Meaning of current character as control character 113 | unsigned int clength; // Length of current character (1..4 bytes) 114 | char *tagbuffer; // Buffer for storing tag that is currently being read 115 | unsigned int tagbuffersize; // Maximum size of tag buffer 116 | unsigned int tagbufferactualsize; // Actual size of tag buffer 117 | enum E_JSON_TAGTYPES tagtype; // Type of value returned by the parser 118 | } JSONPARSER; 119 | 120 | typedef struct ST_JSONLEXER 121 | { 122 | enum E_JSON_TAGTYPES previoustag; // json type of the previous tag 123 | enum E_JSON_TAGTYPES *tagorder; // Array containing types of json parent elements of the current tag 124 | char **tagordername; // Array containing name of json parent elements 125 | unsigned int tagordersize; // Maximum number of elements for tagorder array 126 | unsigned int tagorderactualsize; // Actual number of elements used in tagorder array 127 | unsigned int column; // Column index of current tag 128 | bool error; // Set to true when a lexer error is detected 129 | char *name; // Last found name string 130 | unsigned int namesize; // Maximum length of name 131 | unsigned int nameactualsize; // Actual length of name 132 | char *value; // Last found value string 133 | unsigned int valuesize; // Maximum length of value 134 | unsigned int valueactualsize; // Actual length of value 135 | 136 | } JSONLEXER; 137 | 138 | typedef struct ST_PRESTOCLIENT_FIELD 139 | { 140 | char *name; // Name of column 141 | enum E_FIELDTYPES type; // Type of field 142 | char *data; // Buffer for fielddata 143 | unsigned int datasize; // Size of data buffer 144 | bool dataisnull; // Set to true if content of data is null 145 | } PRESTOCLIENT_FIELD; 146 | 147 | typedef struct ST_PRESTOCLIENT PRESTOCLIENT; 148 | 149 | typedef struct ST_PRESTOCLIENT_RESULT 150 | { 151 | PRESTOCLIENT *client; // Pointer to PRESTOCLIENT 152 | CURL *hcurl; // Handle to libCurl 153 | char *curl_error_buffer; // Buffer for storing curl error messages 154 | void (*write_callback_function)(void*, void*); // Functionpointer to client function handling queryoutput 155 | void (*describe_callback_function)(void*, void*); // Functionpointer to client function handling output description 156 | void *client_object; // Pointer to object to pass to client function 157 | char *lastinfouri; // Uri to query information on the Presto server 158 | char *lastnexturi; // Uri to next dataframe on the Presto server 159 | char *lastcanceluri; // Uri to cancel query on the Presto server 160 | char *laststate; // State returned by last request to Presto server 161 | char *lasterrormessage; // Last error message returned by Presto server 162 | enum E_CLIENTSTATUS clientstatus; // Status defined by PrestoClient: NONE, RUNNING, SUCCEEDED, FAILED 163 | bool cancelquery; // Boolean, when set to true signals that query should be cancelled 164 | char *lastresponse; // Buffer for curl response 165 | size_t lastresponsebuffersize; // Maximum size of the curl buffer 166 | size_t lastresponseactualsize; // Actual size of the curl buffer 167 | PRESTOCLIENT_FIELD **columns; // Buffer for the column information returned by the query 168 | unsigned int columncount; // Number of columns in output or 0 if unknown 169 | bool columninfoavailable; // Flag set to true if columninfo is available and complete (also used for json lexer) 170 | bool columninfoprinted; // Flag set to true if columninfo has been printed to output 171 | int currentdatacolumn; // Index to datafield (columns array) currently handled or -1 when not parsing field data 172 | bool dataavailable; // Flag set to true if a row of data is available 173 | enum E_RESULTCODES errorcode; // Errorcode, set when terminating a request 174 | JSONPARSER *json; // Pointer to the json parser 175 | JSONLEXER *lexer; // Pointer to the json lexer 176 | } PRESTOCLIENT_RESULT; 177 | 178 | typedef struct ST_PRESTOCLIENT 179 | { 180 | char *useragent; // Useragent name sent to Presto server 181 | char *server; // IP address or DNS name of Presto server 182 | unsigned int port; // TCP port of Presto server 183 | char *catalog; // Catalog name to be used by Presto server 184 | char *user; // Username to pass to Presto server 185 | char *timezone; // Timezone to pass to Presto server 186 | char *language; // Language to pass to Presto server 187 | PRESTOCLIENT_RESULT **results; // Array containing query status and data 188 | unsigned int active_results; // Number of queries issued 189 | } PRESTOCLIENT; 190 | 191 | /* --- Functions ------------------------------------------------------------------------------------------------------ */ 192 | 193 | // Utility functions 194 | extern char* get_username(); 195 | extern void util_sleep(const int sleeptime_msec); 196 | 197 | // Memory handling functions 198 | extern void alloc_copy(char **var, const char *newvalue); 199 | extern void alloc_add(char **var, const char *addedvalue); 200 | extern PRESTOCLIENT_FIELD* new_prestofield(); 201 | 202 | // JSON Functions 203 | extern bool json_reader(PRESTOCLIENT_RESULT* result); 204 | extern void json_delete_parser(JSONPARSER* json); 205 | extern void json_delete_lexer(JSONLEXER* lexer); 206 | extern void json_reset_lexer(JSONLEXER* lexer); 207 | 208 | #endif // EASYPTORA_PRESTOCLIENTTYPES_HH -------------------------------------------------------------------------------- /C/prestoclient/curl/include/curl/curlrules.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_CURLRULES_H 2 | #define __CURL_CURLRULES_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | 25 | /* ================================================================ */ 26 | /* COMPILE TIME SANITY CHECKS */ 27 | /* ================================================================ */ 28 | 29 | /* 30 | * NOTE 1: 31 | * ------- 32 | * 33 | * All checks done in this file are intentionally placed in a public 34 | * header file which is pulled by curl/curl.h when an application is 35 | * being built using an already built libcurl library. Additionally 36 | * this file is also included and used when building the library. 37 | * 38 | * If compilation fails on this file it is certainly sure that the 39 | * problem is elsewhere. It could be a problem in the curlbuild.h 40 | * header file, or simply that you are using different compilation 41 | * settings than those used to build the library. 42 | * 43 | * Nothing in this file is intended to be modified or adjusted by the 44 | * curl library user nor by the curl library builder. 45 | * 46 | * Do not deactivate any check, these are done to make sure that the 47 | * library is properly built and used. 48 | * 49 | * You can find further help on the libcurl development mailing list: 50 | * http://cool.haxx.se/mailman/listinfo/curl-library/ 51 | * 52 | * NOTE 2 53 | * ------ 54 | * 55 | * Some of the following compile time checks are based on the fact 56 | * that the dimension of a constant array can not be a negative one. 57 | * In this way if the compile time verification fails, the compilation 58 | * will fail issuing an error. The error description wording is compiler 59 | * dependent but it will be quite similar to one of the following: 60 | * 61 | * "negative subscript or subscript is too large" 62 | * "array must have at least one element" 63 | * "-1 is an illegal array size" 64 | * "size of array is negative" 65 | * 66 | * If you are building an application which tries to use an already 67 | * built libcurl library and you are getting this kind of errors on 68 | * this file, it is a clear indication that there is a mismatch between 69 | * how the library was built and how you are trying to use it for your 70 | * application. Your already compiled or binary library provider is the 71 | * only one who can give you the details you need to properly use it. 72 | */ 73 | 74 | /* 75 | * Verify that some macros are actually defined. 76 | */ 77 | 78 | #ifndef CURL_SIZEOF_LONG 79 | # error "CURL_SIZEOF_LONG definition is missing!" 80 | Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing 81 | #endif 82 | 83 | #ifndef CURL_TYPEOF_CURL_SOCKLEN_T 84 | # error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" 85 | Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing 86 | #endif 87 | 88 | #ifndef CURL_SIZEOF_CURL_SOCKLEN_T 89 | # error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" 90 | Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing 91 | #endif 92 | 93 | #ifndef CURL_TYPEOF_CURL_OFF_T 94 | # error "CURL_TYPEOF_CURL_OFF_T definition is missing!" 95 | Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing 96 | #endif 97 | 98 | #ifndef CURL_FORMAT_CURL_OFF_T 99 | # error "CURL_FORMAT_CURL_OFF_T definition is missing!" 100 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing 101 | #endif 102 | 103 | #ifndef CURL_FORMAT_CURL_OFF_TU 104 | # error "CURL_FORMAT_CURL_OFF_TU definition is missing!" 105 | Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing 106 | #endif 107 | 108 | #ifndef CURL_FORMAT_OFF_T 109 | # error "CURL_FORMAT_OFF_T definition is missing!" 110 | Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing 111 | #endif 112 | 113 | #ifndef CURL_SIZEOF_CURL_OFF_T 114 | # error "CURL_SIZEOF_CURL_OFF_T definition is missing!" 115 | Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing 116 | #endif 117 | 118 | #ifndef CURL_SUFFIX_CURL_OFF_T 119 | # error "CURL_SUFFIX_CURL_OFF_T definition is missing!" 120 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing 121 | #endif 122 | 123 | #ifndef CURL_SUFFIX_CURL_OFF_TU 124 | # error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" 125 | Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing 126 | #endif 127 | 128 | /* 129 | * Macros private to this header file. 130 | */ 131 | 132 | #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 133 | 134 | #define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 135 | 136 | /* 137 | * Verify that the size previously defined and expected for long 138 | * is the same as the one reported by sizeof() at compile time. 139 | */ 140 | 141 | typedef char 142 | __curl_rule_01__ 143 | [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; 144 | 145 | /* 146 | * Verify that the size previously defined and expected for 147 | * curl_off_t is actually the the same as the one reported 148 | * by sizeof() at compile time. 149 | */ 150 | 151 | typedef char 152 | __curl_rule_02__ 153 | [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; 154 | 155 | /* 156 | * Verify at compile time that the size of curl_off_t as reported 157 | * by sizeof() is greater or equal than the one reported for long 158 | * for the current compilation. 159 | */ 160 | 161 | typedef char 162 | __curl_rule_03__ 163 | [CurlchkszGE(curl_off_t, long)]; 164 | 165 | /* 166 | * Verify that the size previously defined and expected for 167 | * curl_socklen_t is actually the the same as the one reported 168 | * by sizeof() at compile time. 169 | */ 170 | 171 | typedef char 172 | __curl_rule_04__ 173 | [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; 174 | 175 | /* 176 | * Verify at compile time that the size of curl_socklen_t as reported 177 | * by sizeof() is greater or equal than the one reported for int for 178 | * the current compilation. 179 | */ 180 | 181 | typedef char 182 | __curl_rule_05__ 183 | [CurlchkszGE(curl_socklen_t, int)]; 184 | 185 | /* ================================================================ */ 186 | /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ 187 | /* ================================================================ */ 188 | 189 | /* 190 | * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow 191 | * these to be visible and exported by the external libcurl interface API, 192 | * while also making them visible to the library internals, simply including 193 | * curl_setup.h, without actually needing to include curl.h internally. 194 | * If some day this section would grow big enough, all this should be moved 195 | * to its own header file. 196 | */ 197 | 198 | /* 199 | * Figure out if we can use the ## preprocessor operator, which is supported 200 | * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ 201 | * or __cplusplus so we need to carefully check for them too. 202 | */ 203 | 204 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ 205 | defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ 206 | defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ 207 | defined(__ILEC400__) 208 | /* This compiler is believed to have an ISO compatible preprocessor */ 209 | #define CURL_ISOCPP 210 | #else 211 | /* This compiler is believed NOT to have an ISO compatible preprocessor */ 212 | #undef CURL_ISOCPP 213 | #endif 214 | 215 | /* 216 | * Macros for minimum-width signed and unsigned curl_off_t integer constants. 217 | */ 218 | 219 | #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) 220 | # define __CURL_OFF_T_C_HLPR2(x) x 221 | # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) 222 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 223 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) 224 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ 225 | __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) 226 | #else 227 | # ifdef CURL_ISOCPP 228 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix 229 | # else 230 | # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix 231 | # endif 232 | # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) 233 | # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) 234 | # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) 235 | #endif 236 | 237 | /* 238 | * Get rid of macros private to this header file. 239 | */ 240 | 241 | #undef CurlchkszEQ 242 | #undef CurlchkszGE 243 | 244 | /* 245 | * Get rid of macros not intended to exist beyond this point. 246 | */ 247 | 248 | #undef CURL_PULL_WS2TCPIP_H 249 | #undef CURL_PULL_SYS_TYPES_H 250 | #undef CURL_PULL_SYS_SOCKET_H 251 | #undef CURL_PULL_SYS_POLL_H 252 | #undef CURL_PULL_STDINT_H 253 | #undef CURL_PULL_INTTYPES_H 254 | 255 | #undef CURL_TYPEOF_CURL_SOCKLEN_T 256 | #undef CURL_TYPEOF_CURL_OFF_T 257 | 258 | #ifdef CURL_NO_OLDIES 259 | #undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */ 260 | #endif 261 | 262 | #endif /* __CURL_CURLRULES_H */ 263 | -------------------------------------------------------------------------------- /python/doc/help.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Help 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 50 | 51 |
  40 | 41 | 42 | 44 | 48 |
[hide private]
[frames] | no frames]
49 |
52 | 53 |

API Documentation

54 | 55 |

This document contains the API (Application Programming Interface) 56 | documentation for this project. Documentation for the Python 57 | objects defined by the project is divided into separate pages for each 58 | package, module, and class. The API documentation also includes two 59 | pages containing information about the project as a whole: a trees 60 | page, and an index page.

61 | 62 |

Object Documentation

63 | 64 |

Each Package Documentation page contains:

65 |
    66 |
  • A description of the package.
  • 67 |
  • A list of the modules and sub-packages contained by the 68 | package.
  • 69 |
  • A summary of the classes defined by the package.
  • 70 |
  • A summary of the functions defined by the package.
  • 71 |
  • A summary of the variables defined by the package.
  • 72 |
  • A detailed description of each function defined by the 73 | package.
  • 74 |
  • A detailed description of each variable defined by the 75 | package.
  • 76 |
77 | 78 |

Each Module Documentation page contains:

79 |
    80 |
  • A description of the module.
  • 81 |
  • A summary of the classes defined by the module.
  • 82 |
  • A summary of the functions defined by the module.
  • 83 |
  • A summary of the variables defined by the module.
  • 84 |
  • A detailed description of each function defined by the 85 | module.
  • 86 |
  • A detailed description of each variable defined by the 87 | module.
  • 88 |
89 | 90 |

Each Class Documentation page contains:

91 |
    92 |
  • A class inheritance diagram.
  • 93 |
  • A list of known subclasses.
  • 94 |
  • A description of the class.
  • 95 |
  • A summary of the methods defined by the class.
  • 96 |
  • A summary of the instance variables defined by the class.
  • 97 |
  • A summary of the class (static) variables defined by the 98 | class.
  • 99 |
  • A detailed description of each method defined by the 100 | class.
  • 101 |
  • A detailed description of each instance variable defined by the 102 | class.
  • 103 |
  • A detailed description of each class (static) variable defined 104 | by the class.
  • 105 |
106 | 107 |

Project Documentation

108 | 109 |

The Trees page contains the module and class hierarchies:

110 |
    111 |
  • The module hierarchy lists every package and module, with 112 | modules grouped into packages. At the top level, and within each 113 | package, modules and sub-packages are listed alphabetically.
  • 114 |
  • The class hierarchy lists every class, grouped by base 115 | class. If a class has more than one base class, then it will be 116 | listed under each base class. At the top level, and under each base 117 | class, classes are listed alphabetically.
  • 118 |
119 | 120 |

The Index page contains indices of terms and 121 | identifiers:

122 |
    123 |
  • The term index lists every term indexed by any object's 124 | documentation. For each term, the index provides links to each 125 | place where the term is indexed.
  • 126 |
  • The identifier index lists the (short) name of every package, 127 | module, class, method, function, variable, and parameter. For each 128 | identifier, the index provides a short description, and a link to 129 | its documentation.
  • 130 |
131 | 132 |

The Table of Contents

133 | 134 |

The table of contents occupies the two frames on the left side of 135 | the window. The upper-left frame displays the project 136 | contents, and the lower-left frame displays the module 137 | contents:

138 | 139 | 140 | 141 | 143 | 146 | 147 | 148 | 151 | 152 |
142 | Project
Contents
...
144 | API
Documentation
Frame


145 |
149 | Module
Contents
 
...
  150 |

153 | 154 |

The project contents frame contains a list of all packages 155 | and modules that are defined by the project. Clicking on an entry 156 | will display its contents in the module contents frame. Clicking on a 157 | special entry, labeled "Everything," will display the contents of 158 | the entire project.

159 | 160 |

The module contents frame contains a list of every 161 | submodule, class, type, exception, function, and variable defined by a 162 | module or package. Clicking on an entry will display its 163 | documentation in the API documentation frame. Clicking on the name of 164 | the module, at the top of the frame, will display the documentation 165 | for the module itself.

166 | 167 |

The "frames" and "no frames" buttons below the top 168 | navigation bar can be used to control whether the table of contents is 169 | displayed or not.

170 | 171 |

The Navigation Bar

172 | 173 |

A navigation bar is located at the top and bottom of every page. 174 | It indicates what type of page you are currently viewing, and allows 175 | you to go to related pages. The following table describes the labels 176 | on the navigation bar. Note that not some labels (such as 177 | [Parent]) are not displayed on all pages.

178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 192 | 193 | 194 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 |
LabelHighlighted when...Links to...
[Parent](never highlighted) the parent of the current package
[Package]viewing a packagethe package containing the current object 191 |
[Module]viewing a modulethe module containing the current object 195 |
[Class]viewing a class the class containing the current object
[Trees]viewing the trees page the trees page
[Index]viewing the index page the index page
[Help]viewing the help page the help page
209 | 210 |

The "show private" and "hide private" buttons below 211 | the top navigation bar can be used to control whether documentation 212 | for private objects is displayed. Private objects are usually defined 213 | as objects whose (short) names begin with a single underscore, but do 214 | not end with an underscore. For example, "_x", 215 | "__pprint", and "epydoc.epytext._tokenize" 216 | are private objects; but "re.sub", 217 | "__init__", and "type_" are not. However, 218 | if a module defines the "__all__" variable, then its 219 | contents are used to decide which objects are private.

220 | 221 |

A timestamp below the bottom navigation bar indicates when each 222 | page was last updated.

223 | 224 | 226 | 227 | 228 | 230 | 231 | 232 | 234 | 235 | 236 | 238 | 239 | 240 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 251 | 255 | 256 |
257 | 258 | 267 | 268 | 269 | -------------------------------------------------------------------------------- /python/doc/epydoc.js: -------------------------------------------------------------------------------- 1 | function toggle_private() { 2 | // Search for any private/public links on this page. Store 3 | // their old text in "cmd," so we will know what action to 4 | // take; and change their text to the opposite action. 5 | var cmd = "?"; 6 | var elts = document.getElementsByTagName("a"); 7 | for(var i=0; i...
"; 127 | elt.innerHTML = s; 128 | } 129 | } 130 | 131 | function toggle(id) { 132 | elt = document.getElementById(id+"-toggle"); 133 | if (elt.innerHTML == "-") 134 | collapse(id); 135 | else 136 | expand(id); 137 | return false; 138 | } 139 | 140 | function highlight(id) { 141 | var elt = document.getElementById(id+"-def"); 142 | if (elt) elt.className = "py-highlight-hdr"; 143 | var elt = document.getElementById(id+"-expanded"); 144 | if (elt) elt.className = "py-highlight"; 145 | var elt = document.getElementById(id+"-collapsed"); 146 | if (elt) elt.className = "py-highlight"; 147 | } 148 | 149 | function num_lines(s) { 150 | var n = 1; 151 | var pos = s.indexOf("\n"); 152 | while ( pos > 0) { 153 | n += 1; 154 | pos = s.indexOf("\n", pos+1); 155 | } 156 | return n; 157 | } 158 | 159 | // Collapse all blocks that mave more than `min_lines` lines. 160 | function collapse_all(min_lines) { 161 | var elts = document.getElementsByTagName("div"); 162 | for (var i=0; i 0) 166 | if (elt.id.substring(split, elt.id.length) == "-expanded") 167 | if (num_lines(elt.innerHTML) > min_lines) 168 | collapse(elt.id.substring(0, split)); 169 | } 170 | } 171 | 172 | function expandto(href) { 173 | var start = href.indexOf("#")+1; 174 | if (start != 0 && start != href.length) { 175 | if (href.substring(start, href.length) != "-") { 176 | collapse_all(4); 177 | pos = href.indexOf(".", start); 178 | while (pos != -1) { 179 | var id = href.substring(start, pos); 180 | expand(id); 181 | pos = href.indexOf(".", pos+1); 182 | } 183 | var id = href.substring(start, href.length); 184 | expand(id); 185 | highlight(id); 186 | } 187 | } 188 | } 189 | 190 | function kill_doclink(id) { 191 | var parent = document.getElementById(id); 192 | parent.removeChild(parent.childNodes.item(0)); 193 | } 194 | function auto_kill_doclink(ev) { 195 | if (!ev) var ev = window.event; 196 | if (!this.contains(ev.toElement)) { 197 | var parent = document.getElementById(this.parentID); 198 | parent.removeChild(parent.childNodes.item(0)); 199 | } 200 | } 201 | 202 | function doclink(id, name, targets_id) { 203 | var elt = document.getElementById(id); 204 | 205 | // If we already opened the box, then destroy it. 206 | // (This case should never occur, but leave it in just in case.) 207 | if (elt.childNodes.length > 1) { 208 | elt.removeChild(elt.childNodes.item(0)); 209 | } 210 | else { 211 | // The outer box: relative + inline positioning. 212 | var box1 = document.createElement("div"); 213 | box1.style.position = "relative"; 214 | box1.style.display = "inline"; 215 | box1.style.top = 0; 216 | box1.style.left = 0; 217 | 218 | // A shadow for fun 219 | var shadow = document.createElement("div"); 220 | shadow.style.position = "absolute"; 221 | shadow.style.left = "-1.3em"; 222 | shadow.style.top = "-1.3em"; 223 | shadow.style.background = "#404040"; 224 | 225 | // The inner box: absolute positioning. 226 | var box2 = document.createElement("div"); 227 | box2.style.position = "relative"; 228 | box2.style.border = "1px solid #a0a0a0"; 229 | box2.style.left = "-.2em"; 230 | box2.style.top = "-.2em"; 231 | box2.style.background = "white"; 232 | box2.style.padding = ".3em .4em .3em .4em"; 233 | box2.style.fontStyle = "normal"; 234 | box2.onmouseout=auto_kill_doclink; 235 | box2.parentID = id; 236 | 237 | // Get the targets 238 | var targets_elt = document.getElementById(targets_id); 239 | var targets = targets_elt.getAttribute("targets"); 240 | var links = ""; 241 | target_list = targets.split(","); 242 | for (var i=0; i" + 246 | target[0] + ""; 247 | } 248 | 249 | // Put it all together. 250 | elt.insertBefore(box1, elt.childNodes.item(0)); 251 | //box1.appendChild(box2); 252 | box1.appendChild(shadow); 253 | shadow.appendChild(box2); 254 | box2.innerHTML = 255 | "Which "+name+" do you want to see documentation for?" + 256 | ""; 261 | } 262 | return false; 263 | } 264 | 265 | function get_anchor() { 266 | var href = location.href; 267 | var start = href.indexOf("#")+1; 268 | if ((start != 0) && (start != href.length)) 269 | return href.substring(start, href.length); 270 | } 271 | function redirect_url(dottedName) { 272 | // Scan through each element of the "pages" list, and check 273 | // if "name" matches with any of them. 274 | for (var i=0; i-m" or "-c"; 277 | // extract the portion & compare it to dottedName. 278 | var pagename = pages[i].substring(0, pages[i].length-2); 279 | if (pagename == dottedName.substring(0,pagename.length)) { 280 | 281 | // We've found a page that matches `dottedName`; 282 | // construct its URL, using leftover `dottedName` 283 | // content to form an anchor. 284 | var pagetype = pages[i].charAt(pages[i].length-1); 285 | var url = pagename + ((pagetype=="m")?"-module.html": 286 | "-class.html"); 287 | if (dottedName.length > pagename.length) 288 | url += "#" + dottedName.substring(pagename.length+1, 289 | dottedName.length); 290 | return url; 291 | } 292 | } 293 | } 294 | -------------------------------------------------------------------------------- /python/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /RPresto/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /RPresto/R/RPresto.R: -------------------------------------------------------------------------------- 1 | # PrestoClient provides a method to communicate with a Presto server. Presto is a fast query 2 | # engine developed by Facebook that runs distributed queries against Hadoop HDFS servers. 3 | # 4 | # Copyright 2013 Ivo Herweijer | easydatawarehousing.com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at: 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | library("RCurl") 19 | library("jsonlite") 20 | 21 | ################################################################################################################### 22 | PrestoClient <- setRefClass( 23 | "PrestoClient" 24 | , 25 | fields = list( 26 | mSource = "character", # Client name sent to Presto server 27 | mVersion = "character", # PrestoClient version string 28 | mUseragent = "character", # Useragent name sent to Presto server 29 | mUrlTimeout = "numeric", # Timeout in millisec to wait for Presto server to respond 30 | mUpdateWaittimemsec = "numeric", # Wait time in millisec to wait between requests to Presto server 31 | #mRetryWaittimemsec = "numeric", # Wait time in millisec to wait before retrying a request 32 | #mMaximumRetries = "numeric", # Maximum number of retries fro request in case of 503 errors 33 | mServer = "character", # IP address or DNS name of Presto server 34 | mPort = "numeric", # TCP port of Presto server 35 | mCatalog = "character", # Catalog name to be used by Presto server 36 | mUser = "character", # Username to pass to Presto server 37 | mLasterror = "character", # Html error of last request 38 | mLastinfouri = "character", # Uri to query information on the Presto server 39 | mLastnexturi = "character", # Uri to next dataframe on the Presto server 40 | mLastcanceluri = "character", # Uri to cancel query on the Presto server 41 | mLaststate = "character", # State returned by last request to Presto server 42 | mClientStatus = "character", # Status defined by PrestoClient: NONE, RUNNING, SUCCEEDED, FAILED 43 | mCancelquery = "logical", # Boolean, when set to True signals that query should be cancelled 44 | mResponse = "list", # Buffer for last response of Presto server 45 | mColumns = "data.frame", # Buffer for the column information returned by the query 46 | mData = "data.frame" # Buffer for the data returned by the query 47 | ) 48 | , 49 | methods = list( 50 | initialize = function(inServer, inPort=8080, inCatalog="hive", inUser="") { 51 | mSource <<- "RPresto" 52 | mVersion <<- "0.2.1" 53 | mUseragent <<- paste(mSource, "/", mVersion, sep = "") 54 | mUrlTimeout <<- 5000 55 | mUpdateWaittimemsec <<- 1500 56 | #mRetryWaittimemsec <<- 100 57 | #mMaximumRetries <<- 5 58 | mServer <<- inServer 59 | mPort <<- inPort 60 | mCatalog <<- inCatalog 61 | mUser <<- ifelse(inUser == "", Sys.info()["user"], inUser) 62 | mLasterror <<- "" 63 | mLastinfouri <<- "" 64 | mLastnexturi <<- "" 65 | mLastcanceluri <<- "" 66 | mLaststate <<- "" 67 | mClientStatus <<- "NONE" 68 | mCancelquery <<- FALSE 69 | mResponse <<- list() 70 | mColumns <<- data.frame() 71 | mData <<- data.frame() 72 | }, 73 | getversion = function() { 74 | return(mVersion) 75 | }, 76 | getlastresponse = function() { 77 | return(mResponse) 78 | }, 79 | getstatus = function() { 80 | return(mClientStatus) 81 | }, 82 | getlastserverstate = function() { 83 | return(mLaststate) 84 | }, 85 | getlasterrormessage = function() { 86 | return(mLasterror) 87 | }, 88 | getcolumns = function() { 89 | return(mColumns) 90 | }, 91 | getnumberofdatarows = function() { 92 | return(nrow(mData) ) 93 | }, 94 | getdata = function() { 95 | return(mData) 96 | }, 97 | cleardata = function() { 98 | return(mData <<- data.frame() ) 99 | }, 100 | startquery = function(inSqlStatement, inSchema="default") { 101 | success <- FALSE 102 | 103 | header <- c("X-Presto-Catalog" = mCatalog, 104 | "X-Presto-Source" = mSource, 105 | "X-Presto-Schema" = inSchema, 106 | "User-Agent" = mUseragent, 107 | "X-Presto-User" = mUser) 108 | 109 | # Prepare statement 110 | sql <- inSqlStatement 111 | sql <- sub(" +$", "", sql) 112 | sql <- sub(";+$", "", sql) 113 | 114 | if (sql == "") { 115 | mLasterror <<- "No query entered" 116 | } else { 117 | # Check current state, any status except running is okay 118 | if (mClientStatus == "RUNNING") { 119 | mLasterror <<- "Query already running. Please create a new instance of PrestoClient class" 120 | } else { 121 | # Reset variables 122 | mLasterror <<- "" 123 | mLastinfouri <<- "" 124 | mLastnexturi <<- "" 125 | mLastcanceluri <<- "" 126 | mLaststate <<- "" 127 | mCancelquery <<- FALSE 128 | mResponse <<- list() 129 | mColumns <<- data.frame() 130 | mData <<- data.frame() 131 | 132 | resp <- basicTextGatherer() 133 | handle <- getCurlHandle() 134 | url <- paste("http://", mServer, ":", mPort, "/v1/statement", sep = "") 135 | 136 | tryCatch(curlPerform(url = url, httpheader=header, postfields=sql, writefunction=resp$update, curl=handle, timeout.ms=mUrlTimeout, followlocation=TRUE), 137 | error = function(x) { 138 | mLasterror <<- paste("Error connecting to server: ", mServer, ":", as.character(mPort), " : ", class(x)[1], sep = "") 139 | }) 140 | 141 | if (mLasterror == "") { 142 | status <- getCurlInfo(handle)$response.code 143 | 144 | if (status != 200) { 145 | mLasterror <<- paste("Connection error:", as.character(status) ) 146 | } else { 147 | mResponse <<- jsonlite::fromJSON(resp$value()) 148 | getvarsfromresponse() 149 | success <- TRUE 150 | } 151 | } 152 | } 153 | } 154 | 155 | return(success) 156 | }, 157 | runquery = function(inSqlStatement, inSchema="default", inVerbose=FALSE) { 158 | if (!startquery(inSqlStatement, inSchema) ) { 159 | print(mLasterror) 160 | } else { 161 | waituntilfinished(inVerbose) 162 | if (mLasterror == "FAILED") print(mLasterror) 163 | } 164 | return(mData) 165 | }, 166 | waituntilfinished = function(inVerbose=FALSE) { 167 | tries <- 0 168 | 169 | while (queryisrunning() ) { 170 | if (inVerbose) { 171 | tries <- tries + 1 172 | print(paste("Ping: ", as.character(tries), " Rows =", as.character(getnumberofdatarows()))) 173 | } 174 | 175 | Sys.sleep(mUpdateWaittimemsec / 1000) 176 | } 177 | 178 | if (inVerbose) print(paste("Done: ", as.character(tries), " Rows =", as.character(getnumberofdatarows()))) 179 | 180 | updatedatatypes() 181 | }, 182 | queryisrunning = function() { 183 | running <- TRUE 184 | 185 | if (mCancelquery) { 186 | cancel() 187 | running <- FALSE 188 | } 189 | else { 190 | if (mLastnexturi == "") { 191 | running <- FALSE 192 | } 193 | else { 194 | if (!openuri(mLastnexturi) ) { 195 | running <- FALSE 196 | } 197 | else { 198 | getvarsfromresponse() 199 | 200 | if (mLastnexturi == "") { 201 | running <- FALSE 202 | } 203 | } 204 | } 205 | } 206 | 207 | return(running) 208 | }, 209 | getqueryinfo = function() { 210 | info <- list() 211 | 212 | if (mLastinfouri != "") { 213 | if (openuri(mLastinfouri, FALSE) ) { 214 | info <- mResponse 215 | } 216 | } 217 | 218 | return(info) 219 | }, 220 | cancelquery = function() { 221 | mCancelquery <<- TRUE 222 | }, 223 | openuri = function(inUri, inSimplifyDF=TRUE) { 224 | success <- FALSE 225 | mLasterror <<- "" 226 | header <- c("X-Presto-Source" = mSource, 227 | "User-Agent" = mUseragent, 228 | "X-Presto-User" = mUser) 229 | 230 | # Todo: implement handling of 503 response 231 | resp <- basicTextGatherer() 232 | handle <- getCurlHandle() 233 | tryCatch(curlPerform(url = inUri, httpheader=header, writefunction=resp$update, curl=handle, timeout.ms=mUrlTimeout, followlocation=TRUE), 234 | error = function(x) { 235 | mLasterror <<- paste("URL error: ", inUri, " : ", class(x)[1], sep = "") 236 | }) 237 | 238 | if (mLasterror == "") { 239 | mResponse <<- jsonlite::fromJSON(resp$value(), simplifyDataFrame=inSimplifyDF) 240 | success <- TRUE 241 | } 242 | 243 | return(success) 244 | }, 245 | getvarsfromresponse = function() { 246 | mLastnexturi <<- "" 247 | if ("infoUri" %in% names(mResponse) ) mLastinfouri <<- mResponse$infoUri 248 | if ("nextUri" %in% names(mResponse) ) mLastnexturi <<- mResponse$nextUri 249 | if ("partialCancelUri" %in% names(mResponse) ) mLastcanceluri <<- mResponse$partialCancelUri 250 | if ("state" %in% names(mResponse) ) mLaststate <<- mResponse$state 251 | else { 252 | if ("stats" %in% names(mResponse) & "state" %in% names(mResponse$stats) ) 253 | mLaststate <<- mResponse$stats$state 254 | } 255 | 256 | if ("state" %in% names(mResponse) ) mLaststate <<- mResponse$state 257 | 258 | if (length(mColumns) == 0) { 259 | if ("columns" %in% names(mResponse) ) mColumns <<- mResponse$columns 260 | } 261 | 262 | # Add/append data 263 | if ("data" %in% names(mResponse) ) { 264 | if (length(mData) == 0) { 265 | mData <<- data.frame(mResponse$data, stringsAsFactors=FALSE) 266 | names(mData) <<- mColumns[,1] 267 | } 268 | else { 269 | tempdata <- data.frame(mResponse$data, stringsAsFactors=FALSE) 270 | names(tempdata) <- mColumns[,1] 271 | mData <<- rbind(mData, tempdata) 272 | } 273 | } 274 | 275 | # Determine state 276 | if (mLastnexturi != "") { 277 | mClientStatus <<- "RUNNING" 278 | } 279 | else { 280 | if ("error" %in% names(mResponse) ) { 281 | mClientStatus <<- "FAILED" 282 | 283 | # Get errormessage 284 | if ("failureInfo" %in% names(mResponse$error) & "message" %in% names(mResponse$error$failureInfo) ) { 285 | mLasterror <<- mResponse$error$failureInfo$message 286 | } 287 | } 288 | else { 289 | mClientStatus <<- "SUCCEEDED" 290 | } 291 | } 292 | }, 293 | updatedatatypes = function() { 294 | if (length(mColumns) > 0 & length(mData) > 0) { 295 | for (i in 1:nrow(mColumns) ) { 296 | if (mColumns[i,2] == "bigint" | mColumns[i,2] == "double") { 297 | mData[,i] <<- as.numeric(mData[,i]) 298 | } else { 299 | if (mColumns[i,2] == "boolean") { 300 | mData[,i] <<- as.logical(mData[,i]) 301 | } 302 | } 303 | } 304 | } 305 | }, 306 | cancel = function() { 307 | success <- FALSE 308 | mLasterror <<- "" 309 | 310 | if (mLastcanceluri != "") { 311 | header <- c("X-Presto-Source" = mSource, 312 | "User-Agent" = mUseragent, 313 | "X-Presto-User" = mUser) 314 | 315 | resp <- basicTextGatherer() 316 | handle <- getCurlHandle() 317 | tryCatch(httpDELETE(url = inUri, httpheader=header, writefunction=resp$update, curl=handle, timeout.ms=mUrlTimeout), 318 | error = function(x) { 319 | mLasterror <<- paste("URL error: ", mLastcanceluri, " : ", class(x)[1], sep = "") 320 | }) 321 | 322 | if (mLasterror == "") { 323 | success <- TRUE 324 | mClientStatus <<- "NONE" 325 | } 326 | } 327 | 328 | return(success) 329 | } 330 | ) 331 | ) -------------------------------------------------------------------------------- /C/prestoclient/prestoclient.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file prestoclient.h 3 | * 4 | * \brief prestoclient implements the client protocol to communicate with a Presto server 5 | * 6 | * Presto (http://prestodb.io/) is a fast query engine developed 7 | * by Facebook that runs distributed queries against a (cluster of) 8 | * Hadoop HDFS servers (http://hadoop.apache.org/). 9 | * Presto uses SQL as its query language. Presto is an alternative for Hadoop-Hive. 10 | * 11 | * This file is part of cPrestoClient 12 | * 13 | * Copyright (C) 2014 Ivo Herweijer 14 | * 15 | * cPrestoClient is free software: you can redistribute it and/or modify 16 | * it under the terms of the GNU General Public License as published by 17 | * the Free Software Foundation, either version 3 of the License, or 18 | * (at your option) any later version. 19 | * 20 | * This program is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public License 26 | * along with this program. If not, see . 27 | * 28 | * You can contact me via email: info@easydatawarehousing.com 29 | */ 30 | 31 | #ifndef EASYPTORA_PRESTOCLIENT_HH 32 | #define EASYPTORA_PRESTOCLIENT_HH 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /* --- Defines -------------------------------------------------------------------------------------------------------- */ 39 | #define PRESTOCLIENT_SOURCE "cPrestoClient" /**< Client name sent to Presto server */ 40 | #define PRESTOCLIENT_VERSION "0.3.1" /**< PrestoClient version string */ 41 | #define PRESTOCLIENT_URLTIMEOUT 5000 /**< Timeout in millisec to wait for Presto server to respond */ 42 | #define PRESTOCLIENT_UPDATEWAITTIMEMSEC 1500 /**< Wait time in millisec to wait between requests to Presto server */ 43 | #define PRESTOCLIENT_RETRIEVEWAITTIMEMSEC 50 /**< Wait time in millisec to wait before getting next data packet */ 44 | #define PRESTOCLIENT_RETRYWAITTIMEMSEC 100 /**< Wait time in millisec to wait before retrying a request */ 45 | #define PRESTOCLIENT_MAXIMUMRETRIES 5 /**< Maximum number of retries for request in case of 503 errors */ 46 | #define PRESTOCLIENT_DEFAULT_PORT 8080 /**< Default tcp port of presto server */ 47 | #define PRESTOCLIENT_DEFAULT_CATALOG "hive" /**< Default presto catalog name */ 48 | #define PRESTOCLIENT_DEFAULT_SCHEMA "default" /**< Default presto schema name */ 49 | 50 | /* --- Enums ---------------------------------------------------------------------------------------------------------- */ 51 | /** 52 | * \brief Fieldtypes returned by prestoclient 53 | */ 54 | enum E_FIELDTYPES 55 | { 56 | PRESTOCLIENT_TYPE_UNDEFINED = 0, 57 | PRESTOCLIENT_TYPE_VARCHAR, 58 | PRESTOCLIENT_TYPE_BIGINT, 59 | PRESTOCLIENT_TYPE_BOOLEAN, 60 | PRESTOCLIENT_TYPE_DOUBLE, 61 | // New in Presto V0.66 62 | PRESTOCLIENT_TYPE_DATE, 63 | PRESTOCLIENT_TYPE_TIME, 64 | PRESTOCLIENT_TYPE_TIME_WITH_TIME_ZONE, 65 | PRESTOCLIENT_TYPE_TIMESTAMP, 66 | PRESTOCLIENT_TYPE_TIMESTAMP_WITH_TIME_ZONE, 67 | PRESTOCLIENT_TYPE_INTERVAL_YEAR_TO_MONTH, 68 | PRESTOCLIENT_TYPE_INTERVAL_DAY_TO_SECOND 69 | // For future implementation 70 | // PRESTOCLIENT_TYPE_ARRAY, 71 | // PRESTOCLIENT_TYPE_MAP, 72 | }; 73 | 74 | /** 75 | * \brief Status of a query determined by prestoclient 76 | */ 77 | enum E_CLIENTSTATUS 78 | { 79 | PRESTOCLIENT_STATUS_NONE = 0, 80 | PRESTOCLIENT_STATUS_RUNNING, 81 | PRESTOCLIENT_STATUS_SUCCEEDED, 82 | PRESTOCLIENT_STATUS_FAILED 83 | }; 84 | 85 | /* --- Structs -------------------------------------------------------------------------------------------------------- */ 86 | /** 87 | * \brief Query resultset used to interface with prestoclient. All members are private. 88 | */ 89 | typedef struct ST_PRESTOCLIENT_RESULT PRESTOCLIENT_RESULT; 90 | 91 | /** 92 | * \brief Client interface for prestoclient. All members are private. 93 | */ 94 | typedef struct ST_PRESTOCLIENT PRESTOCLIENT; 95 | 96 | /* --- Functions ------------------------------------------------------------------------------------------------------ */ 97 | /** 98 | * \brief Get the version string of prestoclient 99 | * 100 | * \return Null terminated version string 101 | */ 102 | char* prestoclient_getversion(); 103 | 104 | /** 105 | * \brief Initiate a client connection 106 | * 107 | * \param in_server String contaning the servername or address. Should be without the port number. Not NULL 108 | * \param in_port Unsigned int containing the tcp port of the Presto server. May be NULL 109 | * \param in_catalog String contaning the Hive catalog name. May be NULL 110 | * \param in_user String contaning the username for the Presto server. May be NULL 111 | * \param in_pwd String contaning the password for the Presto server. May be NULL. Currently not used 112 | * \param in_timezone String contaning the Timezone for the Presto server. May be NULL. (IANA timezone format) 113 | * \param in_language String contaning the Language for the Presto server. May be NULL. (ISO-639-1 code) 114 | * 115 | * \return A handle to the PRESTOCLIENT object if successful or NULL if init failed 116 | */ 117 | PRESTOCLIENT* prestoclient_init ( const char *in_server 118 | , const unsigned int *in_port 119 | , const char *in_catalog 120 | , const char *in_user 121 | , const char *in_pwd 122 | , const char *in_timezone 123 | , const char *in_language); 124 | 125 | /** 126 | * \brief Close client connection 127 | * Close client connection and delete all used memory. Handle to object is NULL after 128 | * calling this function. 129 | * 130 | * \param prestoclient Handle to PRESTOCLIENT object 131 | */ 132 | void prestoclient_close (PRESTOCLIENT *prestoclient); 133 | 134 | /** 135 | * \brief Execute a query 136 | * Executes a query and calls callback functions when columninfo or data 137 | * is available. 138 | * 139 | * \param prestoclient Handle to PRESTOCLIENT object 140 | * \param in_sql_statement String containing the sql statement that should be executed on the Presto server 141 | * \param in_schema String contaning the Hive schema name. May be NULL 142 | * \param in_write_callback_function Pointer to function called when columninfo is available 143 | * \param in_describe_callback_function Pointer to function called for every available row of data 144 | * \param in_client_object Pointer to a user object, passed to callback functions 145 | * 146 | * \return A handle to the PRESTOCLIENT_RESULT object if successful or NULL if starting the query failed 147 | */ 148 | PRESTOCLIENT_RESULT* prestoclient_query (PRESTOCLIENT *prestoclient 149 | , const char *in_sql_statement 150 | , const char *in_schema 151 | , void (*in_write_callback_function)(void*, void*) 152 | , void (*in_describe_callback_function)(void*, void*) 153 | , void *in_client_object 154 | ); 155 | 156 | /** 157 | * \brief Return the status of the query as determined by prestoclient 158 | * Note this is not the same as the state reported by the Presto server! 159 | * 160 | * \param result A handle to a PRESTOCLIENT_RESULT object 161 | * 162 | * \return Numeric value corresponding to enum E_CLIENTSTATUS 163 | */ 164 | unsigned int prestoclient_getstatus (PRESTOCLIENT_RESULT *result); 165 | 166 | /** 167 | * \brief Return state of the request as reported by the Presto server 168 | * 169 | * \param result A handle to a PRESTOCLIENT_RESULT object 170 | * 171 | * \return Null terminated string 172 | */ 173 | char* prestoclient_getlastserverstate (PRESTOCLIENT_RESULT *result); 174 | 175 | /** 176 | * \brief Returns the number of columns of the query 177 | * 178 | * \param result A handle to a PRESTOCLIENT_RESULT object 179 | * 180 | * \return Number of columns or zero if the resultset doesn't contain columninformation (yet) 181 | */ 182 | unsigned int prestoclient_getcolumncount (PRESTOCLIENT_RESULT *result); 183 | 184 | /** 185 | * \brief Return the column name of the specified column 186 | * 187 | * \param result A handle to a PRESTOCLIENT_RESULT object 188 | * \param columnindex Zero based index of column. Should be smaller than number returned by prestoclient_getcolumncount 189 | * 190 | * \return Null terminated string 191 | */ 192 | char* prestoclient_getcolumnname (PRESTOCLIENT_RESULT *result, const unsigned int columnindex); 193 | 194 | /** 195 | * \brief Return the column type of the specified column 196 | * 197 | * \param result A handle to a PRESTOCLIENT_RESULT object 198 | * \param columnindex Zero based index of column. Should be smaller than number returned by prestoclient_getcolumncount 199 | * 200 | * \return Numeric value corresponding to enum E_FIELDTYPES 201 | */ 202 | unsigned int prestoclient_getcolumntype (PRESTOCLIENT_RESULT *result, const unsigned int columnindex); 203 | 204 | /** 205 | * \brief Return the column type of the specified column as string 206 | * 207 | * \param result A handle to a PRESTOCLIENT_RESULT object 208 | * \param columnindex Zero based index of column. Should be smaller than number returned by prestoclient_getcolumncount 209 | * 210 | * \return Null terminated string 211 | */ 212 | char* prestoclient_getcolumntypedescription (PRESTOCLIENT_RESULT *result, const unsigned int columnindex); 213 | 214 | /** 215 | * \brief Return the content of the specified column for the current row as string 216 | * 217 | * \param result A handle to a PRESTOCLIENT_RESULT object 218 | * \param columnindex Zero based index of column. Should be smaller than number returned by prestoclient_getcolumncount 219 | * 220 | * \return Null terminated string 221 | */ 222 | char* prestoclient_getcolumndata (PRESTOCLIENT_RESULT *result, const unsigned int columnindex); 223 | 224 | /** 225 | * \brief Returns true if the content of the specified column is NULL according to the database 226 | * 227 | * \param result A handle to a PRESTOCLIENT_RESULT object 228 | * \param columnindex Zero based index of column. Should be smaller than number returned by prestoclient_getcolumncount 229 | * 230 | * \return Return true (1) if the content of the specified column is NULL, otherwise false (0) 231 | */ 232 | int prestoclient_getnullcolumnvalue (PRESTOCLIENT_RESULT *result, const unsigned int columnindex); 233 | 234 | /** 235 | * \brief Inform prestoclient to cancel the running query 236 | * Prestoclient should cancel the running query. As soon as prestoclient detects this signal and is not 237 | * in the middle of handling a curl response, it will send a cancel query request to the Presto server 238 | * and return from the prestoclient_query function. 239 | * 240 | * \param result A handle to a PRESTOCLIENT_RESULT object 241 | */ 242 | void prestoclient_cancelquery (PRESTOCLIENT_RESULT *result); 243 | 244 | /** 245 | * \brief Return error message of last executed request generated by the prestoserver 246 | * 247 | * \param result A handle to a PRESTOCLIENT_RESULT object 248 | * 249 | * \return Error message generated by the prestoserver or NULL if there is no error 250 | */ 251 | char* prestoclient_getlastservererror (PRESTOCLIENT_RESULT *result); 252 | 253 | /** 254 | * \brief Returns description of last error of determined by prestoclient 255 | * 256 | * \param result A handle to a PRESTOCLIENT_RESULT object 257 | * 258 | * \return Null terminated string or NULL if no errors occurred 259 | */ 260 | char* prestoclient_getlastclienterror (PRESTOCLIENT_RESULT *result); 261 | 262 | /** 263 | * \brief Returns additional error messages produced by curl 264 | * 265 | * \param result A handle to a PRESTOCLIENT_RESULT object 266 | * 267 | * \return Null terminated string, may be empty 268 | */ 269 | char* prestoclient_getlastcurlerror (PRESTOCLIENT_RESULT *result); 270 | 271 | #ifdef __cplusplus 272 | } 273 | #endif 274 | 275 | #endif // EASYPTORA_PRESTOCLIENT_HH -------------------------------------------------------------------------------- /C/prestoclient/curl/include/curl/multi.h: -------------------------------------------------------------------------------- 1 | #ifndef __CURL_MULTI_H 2 | #define __CURL_MULTI_H 3 | /*************************************************************************** 4 | * _ _ ____ _ 5 | * Project ___| | | | _ \| | 6 | * / __| | | | |_) | | 7 | * | (__| |_| | _ <| |___ 8 | * \___|\___/|_| \_\_____| 9 | * 10 | * Copyright (C) 1998 - 2013, Daniel Stenberg, , et al. 11 | * 12 | * This software is licensed as described in the file COPYING, which 13 | * you should have received as part of this distribution. The terms 14 | * are also available at http://curl.haxx.se/docs/copyright.html. 15 | * 16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell 17 | * copies of the Software, and permit persons to whom the Software is 18 | * furnished to do so, under the terms of the COPYING file. 19 | * 20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 21 | * KIND, either express or implied. 22 | * 23 | ***************************************************************************/ 24 | /* 25 | This is an "external" header file. Don't give away any internals here! 26 | 27 | GOALS 28 | 29 | o Enable a "pull" interface. The application that uses libcurl decides where 30 | and when to ask libcurl to get/send data. 31 | 32 | o Enable multiple simultaneous transfers in the same thread without making it 33 | complicated for the application. 34 | 35 | o Enable the application to select() on its own file descriptors and curl's 36 | file descriptors simultaneous easily. 37 | 38 | */ 39 | 40 | /* 41 | * This header file should not really need to include "curl.h" since curl.h 42 | * itself includes this file and we expect user applications to do #include 43 | * without the need for especially including multi.h. 44 | * 45 | * For some reason we added this include here at one point, and rather than to 46 | * break existing (wrongly written) libcurl applications, we leave it as-is 47 | * but with this warning attached. 48 | */ 49 | #include "curl.h" 50 | 51 | #ifdef __cplusplus 52 | extern "C" { 53 | #endif 54 | 55 | typedef void CURLM; 56 | 57 | typedef enum { 58 | CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or 59 | curl_multi_socket*() soon */ 60 | CURLM_OK, 61 | CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ 62 | CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ 63 | CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ 64 | CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ 65 | CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ 66 | CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ 67 | CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was 68 | attempted to get added - again */ 69 | CURLM_LAST 70 | } CURLMcode; 71 | 72 | /* just to make code nicer when using curl_multi_socket() you can now check 73 | for CURLM_CALL_MULTI_SOCKET too in the same style it works for 74 | curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 75 | #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM 76 | 77 | typedef enum { 78 | CURLMSG_NONE, /* first, not used */ 79 | CURLMSG_DONE, /* This easy handle has completed. 'result' contains 80 | the CURLcode of the transfer */ 81 | CURLMSG_LAST /* last, not used */ 82 | } CURLMSG; 83 | 84 | struct CURLMsg { 85 | CURLMSG msg; /* what this message means */ 86 | CURL *easy_handle; /* the handle it concerns */ 87 | union { 88 | void *whatever; /* message-specific data */ 89 | CURLcode result; /* return code for transfer */ 90 | } data; 91 | }; 92 | typedef struct CURLMsg CURLMsg; 93 | 94 | /* Based on poll(2) structure and values. 95 | * We don't use pollfd and POLL* constants explicitly 96 | * to cover platforms without poll(). */ 97 | #define CURL_WAIT_POLLIN 0x0001 98 | #define CURL_WAIT_POLLPRI 0x0002 99 | #define CURL_WAIT_POLLOUT 0x0004 100 | 101 | struct curl_waitfd { 102 | curl_socket_t fd; 103 | short events; 104 | short revents; /* not supported yet */ 105 | }; 106 | 107 | /* 108 | * Name: curl_multi_init() 109 | * 110 | * Desc: inititalize multi-style curl usage 111 | * 112 | * Returns: a new CURLM handle to use in all 'curl_multi' functions. 113 | */ 114 | CURL_EXTERN CURLM *curl_multi_init(void); 115 | 116 | /* 117 | * Name: curl_multi_add_handle() 118 | * 119 | * Desc: add a standard curl handle to the multi stack 120 | * 121 | * Returns: CURLMcode type, general multi error code. 122 | */ 123 | CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, 124 | CURL *curl_handle); 125 | 126 | /* 127 | * Name: curl_multi_remove_handle() 128 | * 129 | * Desc: removes a curl handle from the multi stack again 130 | * 131 | * Returns: CURLMcode type, general multi error code. 132 | */ 133 | CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, 134 | CURL *curl_handle); 135 | 136 | /* 137 | * Name: curl_multi_fdset() 138 | * 139 | * Desc: Ask curl for its fd_set sets. The app can use these to select() or 140 | * poll() on. We want curl_multi_perform() called as soon as one of 141 | * them are ready. 142 | * 143 | * Returns: CURLMcode type, general multi error code. 144 | */ 145 | CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, 146 | fd_set *read_fd_set, 147 | fd_set *write_fd_set, 148 | fd_set *exc_fd_set, 149 | int *max_fd); 150 | 151 | /* 152 | * Name: curl_multi_wait() 153 | * 154 | * Desc: Poll on all fds within a CURLM set as well as any 155 | * additional fds passed to the function. 156 | * 157 | * Returns: CURLMcode type, general multi error code. 158 | */ 159 | CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle, 160 | struct curl_waitfd extra_fds[], 161 | unsigned int extra_nfds, 162 | int timeout_ms, 163 | int *ret); 164 | 165 | /* 166 | * Name: curl_multi_perform() 167 | * 168 | * Desc: When the app thinks there's data available for curl it calls this 169 | * function to read/write whatever there is right now. This returns 170 | * as soon as the reads and writes are done. This function does not 171 | * require that there actually is data available for reading or that 172 | * data can be written, it can be called just in case. It returns 173 | * the number of handles that still transfer data in the second 174 | * argument's integer-pointer. 175 | * 176 | * Returns: CURLMcode type, general multi error code. *NOTE* that this only 177 | * returns errors etc regarding the whole multi stack. There might 178 | * still have occurred problems on invidual transfers even when this 179 | * returns OK. 180 | */ 181 | CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, 182 | int *running_handles); 183 | 184 | /* 185 | * Name: curl_multi_cleanup() 186 | * 187 | * Desc: Cleans up and removes a whole multi stack. It does not free or 188 | * touch any individual easy handles in any way. We need to define 189 | * in what state those handles will be if this function is called 190 | * in the middle of a transfer. 191 | * 192 | * Returns: CURLMcode type, general multi error code. 193 | */ 194 | CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); 195 | 196 | /* 197 | * Name: curl_multi_info_read() 198 | * 199 | * Desc: Ask the multi handle if there's any messages/informationals from 200 | * the individual transfers. Messages include informationals such as 201 | * error code from the transfer or just the fact that a transfer is 202 | * completed. More details on these should be written down as well. 203 | * 204 | * Repeated calls to this function will return a new struct each 205 | * time, until a special "end of msgs" struct is returned as a signal 206 | * that there is no more to get at this point. 207 | * 208 | * The data the returned pointer points to will not survive calling 209 | * curl_multi_cleanup(). 210 | * 211 | * The 'CURLMsg' struct is meant to be very simple and only contain 212 | * very basic informations. If more involved information is wanted, 213 | * we will provide the particular "transfer handle" in that struct 214 | * and that should/could/would be used in subsequent 215 | * curl_easy_getinfo() calls (or similar). The point being that we 216 | * must never expose complex structs to applications, as then we'll 217 | * undoubtably get backwards compatibility problems in the future. 218 | * 219 | * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 220 | * of structs. It also writes the number of messages left in the 221 | * queue (after this read) in the integer the second argument points 222 | * to. 223 | */ 224 | CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, 225 | int *msgs_in_queue); 226 | 227 | /* 228 | * Name: curl_multi_strerror() 229 | * 230 | * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 231 | * value into the equivalent human readable error string. This is 232 | * useful for printing meaningful error messages. 233 | * 234 | * Returns: A pointer to a zero-terminated error message. 235 | */ 236 | CURL_EXTERN const char *curl_multi_strerror(CURLMcode); 237 | 238 | /* 239 | * Name: curl_multi_socket() and 240 | * curl_multi_socket_all() 241 | * 242 | * Desc: An alternative version of curl_multi_perform() that allows the 243 | * application to pass in one of the file descriptors that have been 244 | * detected to have "action" on them and let libcurl perform. 245 | * See man page for details. 246 | */ 247 | #define CURL_POLL_NONE 0 248 | #define CURL_POLL_IN 1 249 | #define CURL_POLL_OUT 2 250 | #define CURL_POLL_INOUT 3 251 | #define CURL_POLL_REMOVE 4 252 | 253 | #define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD 254 | 255 | #define CURL_CSELECT_IN 0x01 256 | #define CURL_CSELECT_OUT 0x02 257 | #define CURL_CSELECT_ERR 0x04 258 | 259 | typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ 260 | curl_socket_t s, /* socket */ 261 | int what, /* see above */ 262 | void *userp, /* private callback 263 | pointer */ 264 | void *socketp); /* private socket 265 | pointer */ 266 | /* 267 | * Name: curl_multi_timer_callback 268 | * 269 | * Desc: Called by libcurl whenever the library detects a change in the 270 | * maximum number of milliseconds the app is allowed to wait before 271 | * curl_multi_socket() or curl_multi_perform() must be called 272 | * (to allow libcurl's timed events to take place). 273 | * 274 | * Returns: The callback should return zero. 275 | */ 276 | typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ 277 | long timeout_ms, /* see above */ 278 | void *userp); /* private callback 279 | pointer */ 280 | 281 | CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, 282 | int *running_handles); 283 | 284 | CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, 285 | curl_socket_t s, 286 | int ev_bitmask, 287 | int *running_handles); 288 | 289 | CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, 290 | int *running_handles); 291 | 292 | #ifndef CURL_ALLOW_OLD_MULTI_SOCKET 293 | /* This macro below was added in 7.16.3 to push users who recompile to use 294 | the new curl_multi_socket_action() instead of the old curl_multi_socket() 295 | */ 296 | #define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) 297 | #endif 298 | 299 | /* 300 | * Name: curl_multi_timeout() 301 | * 302 | * Desc: Returns the maximum number of milliseconds the app is allowed to 303 | * wait before curl_multi_socket() or curl_multi_perform() must be 304 | * called (to allow libcurl's timed events to take place). 305 | * 306 | * Returns: CURLM error code. 307 | */ 308 | CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, 309 | long *milliseconds); 310 | 311 | #undef CINIT /* re-using the same name as in curl.h */ 312 | 313 | #ifdef CURL_ISOCPP 314 | #define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num 315 | #else 316 | /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 317 | #define LONG CURLOPTTYPE_LONG 318 | #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT 319 | #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT 320 | #define OFF_T CURLOPTTYPE_OFF_T 321 | #define CINIT(name,type,number) CURLMOPT_/**/name = type + number 322 | #endif 323 | 324 | typedef enum { 325 | /* This is the socket callback function pointer */ 326 | CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), 327 | 328 | /* This is the argument passed to the socket callback */ 329 | CINIT(SOCKETDATA, OBJECTPOINT, 2), 330 | 331 | /* set to 1 to enable pipelining for this multi handle */ 332 | CINIT(PIPELINING, LONG, 3), 333 | 334 | /* This is the timer callback function pointer */ 335 | CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), 336 | 337 | /* This is the argument passed to the timer callback */ 338 | CINIT(TIMERDATA, OBJECTPOINT, 5), 339 | 340 | /* maximum number of entries in the connection cache */ 341 | CINIT(MAXCONNECTS, LONG, 6), 342 | 343 | /* maximum number of (pipelining) connections to one host */ 344 | CINIT(MAX_HOST_CONNECTIONS, LONG, 7), 345 | 346 | /* maximum number of requests in a pipeline */ 347 | CINIT(MAX_PIPELINE_LENGTH, LONG, 8), 348 | 349 | /* a connection with a content-length longer than this 350 | will not be considered for pipelining */ 351 | CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9), 352 | 353 | /* a connection with a chunk length longer than this 354 | will not be considered for pipelining */ 355 | CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10), 356 | 357 | /* a list of site names(+port) that are blacklisted from 358 | pipelining */ 359 | CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11), 360 | 361 | /* a list of server types that are blacklisted from 362 | pipelining */ 363 | CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12), 364 | 365 | /* maximum number of open connections in total */ 366 | CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13), 367 | 368 | CURLMOPT_LASTENTRY /* the last unused */ 369 | } CURLMoption; 370 | 371 | 372 | /* 373 | * Name: curl_multi_setopt() 374 | * 375 | * Desc: Sets options for the multi handle. 376 | * 377 | * Returns: CURLM error code. 378 | */ 379 | CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, 380 | CURLMoption option, ...); 381 | 382 | 383 | /* 384 | * Name: curl_multi_assign() 385 | * 386 | * Desc: This function sets an association in the multi handle between the 387 | * given socket and a private pointer of the application. This is 388 | * (only) useful for curl_multi_socket uses. 389 | * 390 | * Returns: CURLM error code. 391 | */ 392 | CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, 393 | curl_socket_t sockfd, void *sockp); 394 | 395 | #ifdef __cplusplus 396 | } /* end of extern "C" */ 397 | #endif 398 | 399 | #endif 400 | -------------------------------------------------------------------------------- /python/doc/epydoc.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Epydoc CSS Stylesheet 4 | * 5 | * This stylesheet can be used to customize the appearance of epydoc's 6 | * HTML output. 7 | * 8 | */ 9 | 10 | /* Default Colors & Styles 11 | * - Set the default foreground & background color with 'body'; and 12 | * link colors with 'a:link' and 'a:visited'. 13 | * - Use bold for decision list terms. 14 | * - The heading styles defined here are used for headings *within* 15 | * docstring descriptions. All headings used by epydoc itself use 16 | * either class='epydoc' or class='toc' (CSS styles for both 17 | * defined below). 18 | */ 19 | body { background: #ffffff; color: #000000; } 20 | p { margin-top: 0.5em; margin-bottom: 0.5em; } 21 | a:link { color: #0000ff; } 22 | a:visited { color: #204080; } 23 | dt { font-weight: bold; } 24 | h1 { font-size: +140%; font-style: italic; 25 | font-weight: bold; } 26 | h2 { font-size: +125%; font-style: italic; 27 | font-weight: bold; } 28 | h3 { font-size: +110%; font-style: italic; 29 | font-weight: normal; } 30 | code { font-size: 100%; } 31 | /* N.B.: class, not pseudoclass */ 32 | a.link { font-family: monospace; } 33 | 34 | /* Page Header & Footer 35 | * - The standard page header consists of a navigation bar (with 36 | * pointers to standard pages such as 'home' and 'trees'); a 37 | * breadcrumbs list, which can be used to navigate to containing 38 | * classes or modules; options links, to show/hide private 39 | * variables and to show/hide frames; and a page title (using 40 | *

). The page title may be followed by a link to the 41 | * corresponding source code (using 'span.codelink'). 42 | * - The footer consists of a navigation bar, a timestamp, and a 43 | * pointer to epydoc's homepage. 44 | */ 45 | h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } 46 | h2.epydoc { font-size: +130%; font-weight: bold; } 47 | h3.epydoc { font-size: +115%; font-weight: bold; 48 | margin-top: 0.2em; } 49 | td h3.epydoc { font-size: +115%; font-weight: bold; 50 | margin-bottom: 0; } 51 | table.navbar { background: #a0c0ff; color: #000000; 52 | border: 2px groove #c0d0d0; } 53 | table.navbar table { color: #000000; } 54 | th.navbar-select { background: #70b0ff; 55 | color: #000000; } 56 | table.navbar a { text-decoration: none; } 57 | table.navbar a:link { color: #0000ff; } 58 | table.navbar a:visited { color: #204080; } 59 | span.breadcrumbs { font-size: 85%; font-weight: bold; } 60 | span.options { font-size: 70%; } 61 | span.codelink { font-size: 85%; } 62 | td.footer { font-size: 85%; } 63 | 64 | /* Table Headers 65 | * - Each summary table and details section begins with a 'header' 66 | * row. This row contains a section title (marked by 67 | * 'span.table-header') as well as a show/hide private link 68 | * (marked by 'span.options', defined above). 69 | * - Summary tables that contain user-defined groups mark those 70 | * groups using 'group header' rows. 71 | */ 72 | td.table-header { background: #70b0ff; color: #000000; 73 | border: 1px solid #608090; } 74 | td.table-header table { color: #000000; } 75 | td.table-header table a:link { color: #0000ff; } 76 | td.table-header table a:visited { color: #204080; } 77 | span.table-header { font-size: 120%; font-weight: bold; } 78 | th.group-header { background: #c0e0f8; color: #000000; 79 | text-align: left; font-style: italic; 80 | font-size: 115%; 81 | border: 1px solid #608090; } 82 | 83 | /* Summary Tables (functions, variables, etc) 84 | * - Each object is described by a single row of the table with 85 | * two cells. The left cell gives the object's type, and is 86 | * marked with 'code.summary-type'. The right cell gives the 87 | * object's name and a summary description. 88 | * - CSS styles for the table's header and group headers are 89 | * defined above, under 'Table Headers' 90 | */ 91 | table.summary { border-collapse: collapse; 92 | background: #e8f0f8; color: #000000; 93 | border: 1px solid #608090; 94 | margin-bottom: 0.5em; } 95 | td.summary { border: 1px solid #608090; } 96 | code.summary-type { font-size: 85%; } 97 | table.summary a:link { color: #0000ff; } 98 | table.summary a:visited { color: #204080; } 99 | 100 | 101 | /* Details Tables (functions, variables, etc) 102 | * - Each object is described in its own div. 103 | * - A single-row summary table w/ table-header is used as 104 | * a header for each details section (CSS style for table-header 105 | * is defined above, under 'Table Headers'). 106 | */ 107 | table.details { border-collapse: collapse; 108 | background: #e8f0f8; color: #000000; 109 | border: 1px solid #608090; 110 | margin: .2em 0 0 0; } 111 | table.details table { color: #000000; } 112 | table.details a:link { color: #0000ff; } 113 | table.details a:visited { color: #204080; } 114 | 115 | /* Fields */ 116 | dl.fields { margin-left: 2em; margin-top: 1em; 117 | margin-bottom: 1em; } 118 | dl.fields dd ul { margin-left: 0em; padding-left: 0em; } 119 | dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; } 120 | div.fields { margin-left: 2em; } 121 | div.fields p { margin-bottom: 0.5em; } 122 | 123 | /* Index tables (identifier index, term index, etc) 124 | * - link-index is used for indices containing lists of links 125 | * (namely, the identifier index & term index). 126 | * - index-where is used in link indices for the text indicating 127 | * the container/source for each link. 128 | * - metadata-index is used for indices containing metadata 129 | * extracted from fields (namely, the bug index & todo index). 130 | */ 131 | table.link-index { border-collapse: collapse; 132 | background: #e8f0f8; color: #000000; 133 | border: 1px solid #608090; } 134 | td.link-index { border-width: 0px; } 135 | table.link-index a:link { color: #0000ff; } 136 | table.link-index a:visited { color: #204080; } 137 | span.index-where { font-size: 70%; } 138 | table.metadata-index { border-collapse: collapse; 139 | background: #e8f0f8; color: #000000; 140 | border: 1px solid #608090; 141 | margin: .2em 0 0 0; } 142 | td.metadata-index { border-width: 1px; border-style: solid; } 143 | table.metadata-index a:link { color: #0000ff; } 144 | table.metadata-index a:visited { color: #204080; } 145 | 146 | /* Function signatures 147 | * - sig* is used for the signature in the details section. 148 | * - .summary-sig* is used for the signature in the summary 149 | * table, and when listing property accessor functions. 150 | * */ 151 | .sig-name { color: #006080; } 152 | .sig-arg { color: #008060; } 153 | .sig-default { color: #602000; } 154 | .summary-sig { font-family: monospace; } 155 | .summary-sig-name { color: #006080; font-weight: bold; } 156 | table.summary a.summary-sig-name:link 157 | { color: #006080; font-weight: bold; } 158 | table.summary a.summary-sig-name:visited 159 | { color: #006080; font-weight: bold; } 160 | .summary-sig-arg { color: #006040; } 161 | .summary-sig-default { color: #501800; } 162 | 163 | /* Subclass list 164 | */ 165 | ul.subclass-list { display: inline; } 166 | ul.subclass-list li { display: inline; } 167 | 168 | /* To render variables, classes etc. like functions */ 169 | table.summary .summary-name { color: #006080; font-weight: bold; 170 | font-family: monospace; } 171 | table.summary 172 | a.summary-name:link { color: #006080; font-weight: bold; 173 | font-family: monospace; } 174 | table.summary 175 | a.summary-name:visited { color: #006080; font-weight: bold; 176 | font-family: monospace; } 177 | 178 | /* Variable values 179 | * - In the 'variable details' sections, each varaible's value is 180 | * listed in a 'pre.variable' box. The width of this box is 181 | * restricted to 80 chars; if the value's repr is longer than 182 | * this it will be wrapped, using a backslash marked with 183 | * class 'variable-linewrap'. If the value's repr is longer 184 | * than 3 lines, the rest will be ellided; and an ellipsis 185 | * marker ('...' marked with 'variable-ellipsis') will be used. 186 | * - If the value is a string, its quote marks will be marked 187 | * with 'variable-quote'. 188 | * - If the variable is a regexp, it is syntax-highlighted using 189 | * the re* CSS classes. 190 | */ 191 | pre.variable { padding: .5em; margin: 0; 192 | background: #dce4ec; color: #000000; 193 | border: 1px solid #708890; } 194 | .variable-linewrap { color: #604000; font-weight: bold; } 195 | .variable-ellipsis { color: #604000; font-weight: bold; } 196 | .variable-quote { color: #604000; font-weight: bold; } 197 | .variable-group { color: #008000; font-weight: bold; } 198 | .variable-op { color: #604000; font-weight: bold; } 199 | .variable-string { color: #006030; } 200 | .variable-unknown { color: #a00000; font-weight: bold; } 201 | .re { color: #000000; } 202 | .re-char { color: #006030; } 203 | .re-op { color: #600000; } 204 | .re-group { color: #003060; } 205 | .re-ref { color: #404040; } 206 | 207 | /* Base tree 208 | * - Used by class pages to display the base class hierarchy. 209 | */ 210 | pre.base-tree { font-size: 80%; margin: 0; } 211 | 212 | /* Frames-based table of contents headers 213 | * - Consists of two frames: one for selecting modules; and 214 | * the other listing the contents of the selected module. 215 | * - h1.toc is used for each frame's heading 216 | * - h2.toc is used for subheadings within each frame. 217 | */ 218 | h1.toc { text-align: center; font-size: 105%; 219 | margin: 0; font-weight: bold; 220 | padding: 0; } 221 | h2.toc { font-size: 100%; font-weight: bold; 222 | margin: 0.5em 0 0 -0.3em; } 223 | 224 | /* Syntax Highlighting for Source Code 225 | * - doctest examples are displayed in a 'pre.py-doctest' block. 226 | * If the example is in a details table entry, then it will use 227 | * the colors specified by the 'table pre.py-doctest' line. 228 | * - Source code listings are displayed in a 'pre.py-src' block. 229 | * Each line is marked with 'span.py-line' (used to draw a line 230 | * down the left margin, separating the code from the line 231 | * numbers). Line numbers are displayed with 'span.py-lineno'. 232 | * The expand/collapse block toggle button is displayed with 233 | * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not 234 | * modify the font size of the text.) 235 | * - If a source code page is opened with an anchor, then the 236 | * corresponding code block will be highlighted. The code 237 | * block's header is highlighted with 'py-highlight-hdr'; and 238 | * the code block's body is highlighted with 'py-highlight'. 239 | * - The remaining py-* classes are used to perform syntax 240 | * highlighting (py-string for string literals, py-name for names, 241 | * etc.) 242 | */ 243 | pre.py-doctest { padding: .5em; margin: 1em; 244 | background: #e8f0f8; color: #000000; 245 | border: 1px solid #708890; } 246 | table pre.py-doctest { background: #dce4ec; 247 | color: #000000; } 248 | pre.py-src { border: 2px solid #000000; 249 | background: #f0f0f0; color: #000000; } 250 | .py-line { border-left: 2px solid #000000; 251 | margin-left: .2em; padding-left: .4em; } 252 | .py-lineno { font-style: italic; font-size: 90%; 253 | padding-left: .5em; } 254 | a.py-toggle { text-decoration: none; } 255 | div.py-highlight-hdr { border-top: 2px solid #000000; 256 | border-bottom: 2px solid #000000; 257 | background: #d8e8e8; } 258 | div.py-highlight { border-bottom: 2px solid #000000; 259 | background: #d0e0e0; } 260 | .py-prompt { color: #005050; font-weight: bold;} 261 | .py-more { color: #005050; font-weight: bold;} 262 | .py-string { color: #006030; } 263 | .py-comment { color: #003060; } 264 | .py-keyword { color: #600000; } 265 | .py-output { color: #404040; } 266 | .py-name { color: #000050; } 267 | .py-name:link { color: #000050 !important; } 268 | .py-name:visited { color: #000050 !important; } 269 | .py-number { color: #005000; } 270 | .py-defname { color: #000060; font-weight: bold; } 271 | .py-def-name { color: #000060; font-weight: bold; } 272 | .py-base-class { color: #000060; } 273 | .py-param { color: #000060; } 274 | .py-docstring { color: #006030; } 275 | .py-decorator { color: #804020; } 276 | /* Use this if you don't want links to names underlined: */ 277 | /*a.py-name { text-decoration: none; }*/ 278 | 279 | /* Graphs & Diagrams 280 | * - These CSS styles are used for graphs & diagrams generated using 281 | * Graphviz dot. 'img.graph-without-title' is used for bare 282 | * diagrams (to remove the border created by making the image 283 | * clickable). 284 | */ 285 | img.graph-without-title { border: none; } 286 | img.graph-with-title { border: 1px solid #000000; } 287 | span.graph-title { font-weight: bold; } 288 | span.graph-caption { } 289 | 290 | /* General-purpose classes 291 | * - 'p.indent-wrapped-lines' defines a paragraph whose first line 292 | * is not indented, but whose subsequent lines are. 293 | * - The 'nomargin-top' class is used to remove the top margin (e.g. 294 | * from lists). The 'nomargin' class is used to remove both the 295 | * top and bottom margin (but not the left or right margin -- 296 | * for lists, that would cause the bullets to disappear.) 297 | */ 298 | p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; 299 | margin: 0; } 300 | .nomargin-top { margin-top: 0; } 301 | .nomargin { margin-top: 0; margin-bottom: 0; } 302 | 303 | /* HTML Log */ 304 | div.log-block { padding: 0; margin: .5em 0 .5em 0; 305 | background: #e8f0f8; color: #000000; 306 | border: 1px solid #000000; } 307 | div.log-error { padding: .1em .3em .1em .3em; margin: 4px; 308 | background: #ffb0b0; color: #000000; 309 | border: 1px solid #000000; } 310 | div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; 311 | background: #ffffb0; color: #000000; 312 | border: 1px solid #000000; } 313 | div.log-info { padding: .1em .3em .1em .3em; margin: 4px; 314 | background: #b0ffb0; color: #000000; 315 | border: 1px solid #000000; } 316 | h2.log-hdr { background: #70b0ff; color: #000000; 317 | margin: 0; padding: 0em 0.5em 0em 0.5em; 318 | border-bottom: 1px solid #000000; font-size: 110%; } 319 | p.log { font-weight: bold; margin: .5em 0 .5em 0; } 320 | tr.opt-changed { color: #000000; font-weight: bold; } 321 | tr.opt-default { color: #606060; } 322 | pre.log { margin: 0; padding: 0; padding-left: 1em; } 323 | -------------------------------------------------------------------------------- /python/doc/identifier-index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Identifier Index 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 50 | 51 |
  40 | 41 | 42 | 44 | 48 |
[hide private]
[frames] | no frames]
49 |
52 | 53 |
54 |

Identifier Index

55 |
56 | [ 57 | A 58 | B 59 | C 60 | D 61 | E 62 | F 63 | G 64 | H 65 | I 66 | J 67 | K 68 | L 69 | M 70 | N 71 | O 72 | P 73 | Q 74 | R 75 | S 76 | T 77 | U 78 | V 79 | W 80 | X 81 | Y 82 | Z 83 | _ 84 | ] 85 |
86 | 87 | 88 | 100 | 101 | 129 | 130 | 141 | 142 | 153 | 154 | 165 | 166 | 177 | 178 | 189 | 190 | 273 |

C

89 | 90 | 91 | 93 | 95 | 96 | 97 | 98 | 99 |

G

102 | 103 | 104 | 106 | 108 | 110 | 111 | 112 | 114 | 116 | 118 | 119 | 120 | 122 | 124 | 126 | 127 | 128 |

P

131 | 132 | 133 | 134 | 136 | 137 | 138 | 139 | 140 |

Q

143 | 144 | 145 | 147 | 148 | 149 | 150 | 151 | 152 |

R

155 | 156 | 157 | 159 | 160 | 161 | 162 | 163 | 164 |

S

167 | 168 | 169 | 171 | 172 | 173 | 174 | 175 | 176 |

W

179 | 180 | 181 | 183 | 184 | 185 | 186 | 187 | 188 |

_

191 | 192 | 193 | 195 | 197 | 199 | 200 | 201 | 203 | 205 | 207 | 208 | 209 | 211 | 213 | 215 | 216 | 217 | 219 | 221 | 223 | 224 | 225 | 227 | 229 | 231 | 232 | 233 | 235 | 237 | 239 | 240 | 241 | 243 | 245 | 247 | 248 | 249 | 251 | 253 | 255 | 256 | 257 | 259 | 261 | 263 | 264 | 265 | 267 | 269 | 270 | 271 | 272 |
274 |

275 | 277 | 278 | 279 | 281 | 282 | 283 | 285 | 286 | 287 | 289 | 290 | 291 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 302 | 306 | 307 |
308 | 309 | 318 | 319 | 320 | --------------------------------------------------------------------------------