SlideShare uma empresa Scribd logo
1 de 35
Plugins in Drizzle
Plugins in Drizzle ,[object Object]
~80 plugins already bundled
Drizzle plugins load on startup only
Drizzle plugins more object-orientated
Plugin Types Authentication Authorization Catalogs Error Message Event Observer Function Listen Logging Query Cache Scheduler Schema Engine Storage Engine Table Function Transaction Applier Transaction Replicator
Plugin Loading drizzled --plugin-add=my_plugin,your_plugin drizzled --plugin-remove=unwanted_plugin
Plugin Loading Example: drizzle --plugin-remove=auth_all --plugin-add=auth_file
Plugin.ini [plugin] title= Drizzle Protocol Module description= Drizzle protocol module. Version= 0.3 author= Brian Aker license= PLUGIN_LICENSE_GPL libs= drizzled/algorithm/libhash.la load_by_default= yes ldlfags= $(LIBZ) headers= drizzle_protocol.h sources= drizzle_protocol.cc static= yes
Variables? ,[object Object]
Options processing uses Boost::Program_Options
drizzled --plugin.option=setting
SET plugin_option=setting
Intialization #include <drizzled/plugin.h> #include <drizzled/plugin/*plugin_type.h*> DRIZZLE_DECLARE_PLUGIN { DRIZZLE_VERSION_ID, name, plugin version, author, description, init, dependencies, init_options } DRIZZLE_DECLARE_PLUGIN_END;
Intialization #include <drizzled/plugin.h> #include <drizzled/plugin/*plugin_type.h*> DRIZZLE_PLUGIN ( init, system (unused), init_options )
Initialization static int init(drizzled::module::Context &context) { const module::option_map &vm= context.getOptions(); ListenDrizzleProtocol *protocol=new ListenDrizzleProtocol(&quot;drizzle_protocol&quot;, vm[&quot;bind-address&quot;].as<std::string>(), true); protocol->addCountersToTable(); context.add(protocol); context.registerVariable(new sys_var_constrained_value_readonly<in_port_t>(&quot;port&quot;, port)); ... return 0; }
Initialization static void init_options(drizzled::module::option_context &context) { context(&quot;port&quot;, po::value<port_constraint>(&port)->default_value(DRIZZLE_TCP_PORT), N_(&quot;Port number to use for connection or 0 for default to with Drizzle/MySQL protocol.&quot;)); ... }
Compiling $ cp $DRIZZLE_SRC_ROOT/config/config.rpath config/ $ cp $DRIZZLE_SRC_ROOT/config/pandora-plugin config/ $ cp $DRIZZLE_SRC_ROOT/config/pandora-plugin.ini config/ $ cp -R $DRIZZLE_SRC_PORT/m4 .
Compiling $ ./config/pandora-plugin $ autoreconf -i
Compiling $ ./configure $ make $ make install
Daemon Plugins ,[object Object]
Very similar to MySQL
Daemon Example Plugin.ini: [plugin] name= daemon_example module_name= daemon_example title= Daemon Example Module description= Daemon Example Module version= 0.1 author= Andrew Hutchings url= http://www.linuxjedi.co.uk/ license= PLUGIN_LICENSE_GPL load_by_default= no headers= daemon_example.h sources= daemon_example.cc
Daemon Example daemon_example.cc: #include &quot;config.h&quot; #include <iostream> #include &quot;daemon_example.h&quot; static int init(drizzled::module::Context&) { std::cout << &quot;Hello World!&quot; << std::endl; return 0; } static void init_options(drizzled::module::option_context&) { }
Daemon Example daemon_example.cc: DRIZZLE_DECLARE_PLUGIN { DRIZZLE_VERSION_ID, &quot;daemon-example&quot;, &quot;0.1&quot;, &quot;Andrew Hutchings&quot;, &quot;An example Daemon Plugin&quot;, drizzled::PLUGIN_LICENSE_GPL, init,  /* Plugin Init */ NULL, /* depends */ init_options  /* config options */ } DRIZZLE_DECLARE_PLUGIN_END;
Daemon Example daemon_example.h: #include <drizzled/plugin.h> #include <drizzled/plugin/daemon.h>
TableFunction Plugins ,[object Object]
Incorporates INFORMATION_SCHEMA and DATA_DICTIONARY
In memory only, no disk used
INFORMATION_SCHEMA is SQL standards compliant tables
DATA_DICTIONARY is everything else
Data Dictionary Example plugin.ini: [plugin] name= getrusage module_name= getrusage title= getrusage Data Dictionary Module description= getrusage Data Dictionary Module version= 0.1 author= Andrew Hutchings url= http://www.linuxjedi.co.uk/ license= PLUGIN_LICENSE_GPL load_by_default= no headers= getrusage_plugin.h sources= getrusage_plugin.cc
Data Dictionary Example getrusage_plugin.cc: #include <config.h> #include &quot;getrusage_plugin.h&quot; Getrusage::Getrusage() : drizzled::plugin::TableFunction(&quot;DATA_DICTIONARY&quot;, &quot;GETRUSAGE&quot;) { add_field(&quot;TYPE&quot;, drizzled::plugin::TableFunction::STRING, 7, false); add_field(&quot;TIME&quot;, drizzled::plugin::TableFunction::NUMBER, 0, false); }
Data Dictionary Example getrusage_plugin.cc: Getrusage::Generator::Generator(drizzled::Field **arg) : drizzled::plugin::TableFunction::Generator(arg), counter(0) { counter= 0; getrusage(RUSAGE_SELF, &usage_data); return; }
Data Dictionary Example getrusage_plugin.cc bool Getrusage::Generator::populate() { counter++; if (counter == 1) { push(&quot;USER&quot;); push(usage_data.ru_utime.tv_sec); return true; } if (counter == 2) { push(&quot;SYSTEM&quot;); push(usage_data.ru_stime.tv_sec); return true; } return false; }

Mais conteúdo relacionado

Mais procurados

Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsSolution4Future
 
Building robust and friendly command line applications in go
Building robust and friendly command line applications in goBuilding robust and friendly command line applications in go
Building robust and friendly command line applications in goAndrii Soldatenko
 
A new way to develop with WordPress!
A new way to develop with WordPress!A new way to develop with WordPress!
A new way to develop with WordPress!David Sanchez
 
GDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google CloudGDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google CloudBhavik Shah
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environmentsAdvanced debugging  techniques in different environments
Advanced debugging  techniques in different environmentsAndrii Soldatenko
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPuppet
 
Debugging PHP with Xdebug - PHPUK 2018
Debugging PHP with Xdebug - PHPUK 2018Debugging PHP with Xdebug - PHPUK 2018
Debugging PHP with Xdebug - PHPUK 2018Mark Niebergall
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Puppet
 
Hack in the Box Keynote 2006
Hack in the Box Keynote 2006Hack in the Box Keynote 2006
Hack in the Box Keynote 2006Mark Curphey
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & ToolsIan Barber
 
Groovy on the Shell
Groovy on the ShellGroovy on the Shell
Groovy on the Shellsascha_klein
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Shinya Ohyanagi
 
Debugging concurrency programs in go
Debugging concurrency programs in goDebugging concurrency programs in go
Debugging concurrency programs in goAndrii Soldatenko
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnSandro Zaccarini
 
Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)
Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)
Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)Mark Niebergall
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)James Titcumb
 

Mais procurados (20)

Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutions
 
Building robust and friendly command line applications in go
Building robust and friendly command line applications in goBuilding robust and friendly command line applications in go
Building robust and friendly command line applications in go
 
A new way to develop with WordPress!
A new way to develop with WordPress!A new way to develop with WordPress!
A new way to develop with WordPress!
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
GDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google CloudGDG DevFest 2013 - PHP Web Apps on Google Cloud
GDG DevFest 2013 - PHP Web Apps on Google Cloud
 
Ant
Ant Ant
Ant
 
PHP7 Presentation
PHP7 PresentationPHP7 Presentation
PHP7 Presentation
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environmentsAdvanced debugging  techniques in different environments
Advanced debugging  techniques in different environments
 
Portland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modulesPortland Puppet User Group June 2014: Writing and publishing puppet modules
Portland Puppet User Group June 2014: Writing and publishing puppet modules
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
Debugging PHP with Xdebug - PHPUK 2018
Debugging PHP with Xdebug - PHPUK 2018Debugging PHP with Xdebug - PHPUK 2018
Debugging PHP with Xdebug - PHPUK 2018
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011
 
Hack in the Box Keynote 2006
Hack in the Box Keynote 2006Hack in the Box Keynote 2006
Hack in the Box Keynote 2006
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
Groovy on the Shell
Groovy on the ShellGroovy on the Shell
Groovy on the Shell
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Debugging concurrency programs in go
Debugging concurrency programs in goDebugging concurrency programs in go
Debugging concurrency programs in go
 
PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
 
Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)
Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)
Automatic PHP 7 Compatibility Checking Using php7cc (and PHPCompatibility)
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
 

Destaque

Arquitectura orientada-a-servicios
Arquitectura orientada-a-serviciosArquitectura orientada-a-servicios
Arquitectura orientada-a-serviciosCiencias
 
Transparencia, rendición de cuentas y participación: una agenda comun para la...
Transparencia, rendición de cuentas y participación: una agenda comun para la...Transparencia, rendición de cuentas y participación: una agenda comun para la...
Transparencia, rendición de cuentas y participación: una agenda comun para la...EUROsociAL II
 
G6 m5-a-lesson 4-t
G6 m5-a-lesson 4-tG6 m5-a-lesson 4-t
G6 m5-a-lesson 4-tmlabuski
 
Creadores de la Calidad
Creadores de la CalidadCreadores de la Calidad
Creadores de la Calidadhguzman65
 
Metodika hj skripta
  Metodika hj skripta  Metodika hj skripta
Metodika hj skriptawedrana
 

Destaque (6)

Arquitectura orientada-a-servicios
Arquitectura orientada-a-serviciosArquitectura orientada-a-servicios
Arquitectura orientada-a-servicios
 
Transparencia, rendición de cuentas y participación: una agenda comun para la...
Transparencia, rendición de cuentas y participación: una agenda comun para la...Transparencia, rendición de cuentas y participación: una agenda comun para la...
Transparencia, rendición de cuentas y participación: una agenda comun para la...
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
G6 m5-a-lesson 4-t
G6 m5-a-lesson 4-tG6 m5-a-lesson 4-t
G6 m5-a-lesson 4-t
 
Creadores de la Calidad
Creadores de la CalidadCreadores de la Calidad
Creadores de la Calidad
 
Metodika hj skripta
  Metodika hj skripta  Metodika hj skripta
Metodika hj skripta
 

Semelhante a Drizzle plugins

Developing Drizzle Replication Plugins
Developing Drizzle Replication PluginsDeveloping Drizzle Replication Plugins
Developing Drizzle Replication PluginsPadraig O'Sullivan
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodesnihiliad
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008phpbarcelona
 
JUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleJUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleGeoffrey De Smet
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress pluginAnthony Montalbano
 
June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules Puppet
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Phpfunkatron
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHDavid Stockton
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesLeonardo Fernandes
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Jon Peck
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolGordon Forsythe
 
Debian graylog logging server.docx
Debian graylog logging server.docxDebian graylog logging server.docx
Debian graylog logging server.docxAhmed Swarup
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpointwebhostingguy
 
Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Compare Infobase Limited
 
Writing and Publishing Puppet Modules
Writing and Publishing Puppet ModulesWriting and Publishing Puppet Modules
Writing and Publishing Puppet ModulesPuppet
 
2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools plannerGeoffrey De Smet
 

Semelhante a Drizzle plugins (20)

Developing Drizzle Replication Plugins
Developing Drizzle Replication PluginsDeveloping Drizzle Replication Plugins
Developing Drizzle Replication Plugins
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodes
 
Catalyst MVC
Catalyst MVCCatalyst MVC
Catalyst MVC
 
Php Debugger
Php DebuggerPhp Debugger
Php Debugger
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
 
Writing Pluggable Software
Writing Pluggable SoftwareWriting Pluggable Software
Writing Pluggable Software
 
JUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleJUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by example
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
 
June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules June 2014 PDX PUG: Writing and Publishing Puppet Modules
June 2014 PDX PUG: Writing and Publishing Puppet Modules
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSHTame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
 
Mini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico CesMini Curso Django Ii Congresso Academico Ces
Mini Curso Django Ii Congresso Academico Ces
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Debian graylog logging server.docx
Debian graylog logging server.docxDebian graylog logging server.docx
Debian graylog logging server.docx
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpoint
 
Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation
 
Writing and Publishing Puppet Modules
Writing and Publishing Puppet ModulesWriting and Publishing Puppet Modules
Writing and Publishing Puppet Modules
 
2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner
 

Último

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Drizzle plugins

  • 2.
  • 4. Drizzle plugins load on startup only
  • 5. Drizzle plugins more object-orientated
  • 6. Plugin Types Authentication Authorization Catalogs Error Message Event Observer Function Listen Logging Query Cache Scheduler Schema Engine Storage Engine Table Function Transaction Applier Transaction Replicator
  • 7. Plugin Loading drizzled --plugin-add=my_plugin,your_plugin drizzled --plugin-remove=unwanted_plugin
  • 8. Plugin Loading Example: drizzle --plugin-remove=auth_all --plugin-add=auth_file
  • 9. Plugin.ini [plugin] title= Drizzle Protocol Module description= Drizzle protocol module. Version= 0.3 author= Brian Aker license= PLUGIN_LICENSE_GPL libs= drizzled/algorithm/libhash.la load_by_default= yes ldlfags= $(LIBZ) headers= drizzle_protocol.h sources= drizzle_protocol.cc static= yes
  • 10.
  • 11. Options processing uses Boost::Program_Options
  • 14. Intialization #include <drizzled/plugin.h> #include <drizzled/plugin/*plugin_type.h*> DRIZZLE_DECLARE_PLUGIN { DRIZZLE_VERSION_ID, name, plugin version, author, description, init, dependencies, init_options } DRIZZLE_DECLARE_PLUGIN_END;
  • 15. Intialization #include <drizzled/plugin.h> #include <drizzled/plugin/*plugin_type.h*> DRIZZLE_PLUGIN ( init, system (unused), init_options )
  • 16. Initialization static int init(drizzled::module::Context &context) { const module::option_map &vm= context.getOptions(); ListenDrizzleProtocol *protocol=new ListenDrizzleProtocol(&quot;drizzle_protocol&quot;, vm[&quot;bind-address&quot;].as<std::string>(), true); protocol->addCountersToTable(); context.add(protocol); context.registerVariable(new sys_var_constrained_value_readonly<in_port_t>(&quot;port&quot;, port)); ... return 0; }
  • 17. Initialization static void init_options(drizzled::module::option_context &context) { context(&quot;port&quot;, po::value<port_constraint>(&port)->default_value(DRIZZLE_TCP_PORT), N_(&quot;Port number to use for connection or 0 for default to with Drizzle/MySQL protocol.&quot;)); ... }
  • 18. Compiling $ cp $DRIZZLE_SRC_ROOT/config/config.rpath config/ $ cp $DRIZZLE_SRC_ROOT/config/pandora-plugin config/ $ cp $DRIZZLE_SRC_ROOT/config/pandora-plugin.ini config/ $ cp -R $DRIZZLE_SRC_PORT/m4 .
  • 20. Compiling $ ./configure $ make $ make install
  • 21.
  • 23. Daemon Example Plugin.ini: [plugin] name= daemon_example module_name= daemon_example title= Daemon Example Module description= Daemon Example Module version= 0.1 author= Andrew Hutchings url= http://www.linuxjedi.co.uk/ license= PLUGIN_LICENSE_GPL load_by_default= no headers= daemon_example.h sources= daemon_example.cc
  • 24. Daemon Example daemon_example.cc: #include &quot;config.h&quot; #include <iostream> #include &quot;daemon_example.h&quot; static int init(drizzled::module::Context&) { std::cout << &quot;Hello World!&quot; << std::endl; return 0; } static void init_options(drizzled::module::option_context&) { }
  • 25. Daemon Example daemon_example.cc: DRIZZLE_DECLARE_PLUGIN { DRIZZLE_VERSION_ID, &quot;daemon-example&quot;, &quot;0.1&quot;, &quot;Andrew Hutchings&quot;, &quot;An example Daemon Plugin&quot;, drizzled::PLUGIN_LICENSE_GPL, init, /* Plugin Init */ NULL, /* depends */ init_options /* config options */ } DRIZZLE_DECLARE_PLUGIN_END;
  • 26. Daemon Example daemon_example.h: #include <drizzled/plugin.h> #include <drizzled/plugin/daemon.h>
  • 27.
  • 29. In memory only, no disk used
  • 30. INFORMATION_SCHEMA is SQL standards compliant tables
  • 32. Data Dictionary Example plugin.ini: [plugin] name= getrusage module_name= getrusage title= getrusage Data Dictionary Module description= getrusage Data Dictionary Module version= 0.1 author= Andrew Hutchings url= http://www.linuxjedi.co.uk/ license= PLUGIN_LICENSE_GPL load_by_default= no headers= getrusage_plugin.h sources= getrusage_plugin.cc
  • 33. Data Dictionary Example getrusage_plugin.cc: #include <config.h> #include &quot;getrusage_plugin.h&quot; Getrusage::Getrusage() : drizzled::plugin::TableFunction(&quot;DATA_DICTIONARY&quot;, &quot;GETRUSAGE&quot;) { add_field(&quot;TYPE&quot;, drizzled::plugin::TableFunction::STRING, 7, false); add_field(&quot;TIME&quot;, drizzled::plugin::TableFunction::NUMBER, 0, false); }
  • 34. Data Dictionary Example getrusage_plugin.cc: Getrusage::Generator::Generator(drizzled::Field **arg) : drizzled::plugin::TableFunction::Generator(arg), counter(0) { counter= 0; getrusage(RUSAGE_SELF, &usage_data); return; }
  • 35. Data Dictionary Example getrusage_plugin.cc bool Getrusage::Generator::populate() { counter++; if (counter == 1) { push(&quot;USER&quot;); push(usage_data.ru_utime.tv_sec); return true; } if (counter == 2) { push(&quot;SYSTEM&quot;); push(usage_data.ru_stime.tv_sec); return true; } return false; }
  • 36. Data Dictionary Example getrusage_plugin.cc static int init(drizzled::module::Context &context) { context.add(new Getrusage); return 0; } DRIZZLE_DECLARE_PLUGIN { DRIZZLE_VERSION_ID, &quot;Getrusage Dictionary&quot;, &quot;0.1&quot;, &quot;Andrew Hutchings&quot;, &quot;Data Dictionary for Getrusage&quot;, drizzled::PLUGIN_LICENSE_GPL, init, NULL, NULL } DRIZZLE_DECLARE_PLUGIN_END;
  • 37. Data Dictionary Example getrusage_plugin.h: #include <drizzled/plugin.h> #include <drizzled/plugin/table_function.h> #include <sys/resource.h> class Getrusage : public drizzled::plugin::TableFunction { public: Getrusage();
  • 38. Data Dictionary Example getrusage_plugin.h: class Generator : public drizzled::plugin::TableFunction::Generator { public: Generator(drizzled::Field **arg); bool populate(); int counter; rusage usage_data; }; Generator *generator(drizzled::Field **arg) { return new Generator(arg); } };
  • 39.
  • 40. Same API as MySQL/Drizzle internal functions
  • 41. UDF Example plugin.ini: [plugin] name= udf_example module_name= udf_example title= An example UDF description= An example UDF version= 0.1 author= Andrew Hutchings url= http://www.linuxjedi.co.uk/ license= PLUGIN_LICENSE_GPL load_by_default= no headers= udf_example.h sources= udf_example.cc
  • 42. UDF Example udf_example.cc: #include <config.h> #include <drizzled/lex_string.h> #include &quot;udf_example.h&quot; namespace drizzled { String *Item_func_example::val_str(String *str) { assert(fixed == 1); String *result= args[0]->val_str(str); null_value= args[0]->null_value; return result; } } /* namespace drizzled */
  • 43. UDF Example udf_example.cc: static int init(drizzled::module::Context &context) { context.add(new drizzled::plugin::Create_function<drizzled::Item_func_example>(&quot;example&quot;)); return 0; }
  • 44. UDF Example udf_example.cc: DRIZZLE_DECLARE_PLUGIN { DRIZZLE_VERSION_ID, &quot;Example Function&quot;, &quot;0.1&quot;, &quot;Andrew Hutchings&quot;, &quot;Example Function&quot;, drizzled::PLUGIN_LICENSE_GPL, init, NULL, NULL } DRIZZLE_DECLARE_PLUGIN_END;
  • 45. UDF Example udf_example.h: #include <drizzled/plugin.h> #include <drizzled/plugin/function.h> #include <drizzled/function/str/strfunc.h> namespace drizzled {
  • 46. UDF Example udf_example.h: class Item_func_example: public Item_str_func { public: Item_func_example() : Item_str_func() {} const char *func_name() const { return &quot;example&quot;; } String *val_str(String *); void fix_length_and_dec() { collation.set(args[0]->collation); max_length= args[0]->max_length; } bool check_argument_count(int n) { return n == 1; } }; } /* namespace drizzled */
  • 47. Drizzle Developer Day Friday at the Hilton