Advertisement
Advertisement

More Related Content

Similar to EWD 3 Training Course Part 17: Introduction to Global Storage Databases(20)

Advertisement

More from Rob Tweed(20)

Recently uploaded(20)

Advertisement

EWD 3 Training Course Part 17: Introduction to Global Storage Databases

  1. Copyright © 2016 M/Gateway Developments Ltd EWD 3 Training Course Part 17 Working with Global Storage Databases: Introduction Rob Tweed Director, M/Gateway Developments Ltd Twitter: @rtweed
  2. Copyright © 2016 M/Gateway Developments Ltd EWD 3 Global Storage Modules • ewd-qoper8-cache – Wraps cache.node interface file • ewd-qoper8-gtm – Wraps NodeM module • ewd-qoper8-redis – Wraps ewd-redis-globals module • Designed to be loaded by ewd-qoper8 worker • They both extend this (ewd-qoper8 worker object) – this.db • Installed and configured automatically for you by QEWD
  3. Copyright © 2016 M/Gateway Developments Ltd Three forms of access • Globals (Caché, GT.M & Redis) • Caché & GT.M functions • Caché Objects / classes
  4. Copyright © 2016 M/Gateway Developments Ltd Invoking functions • Provided for anyone modernising Caché or GT.M applications using QEWD – Allows legacy code to be executed via JavaScript – Indirect access to the Global Storage database using their built-in language – Not intended for or needed by JavaScript developers building new QEWD applications
  5. Copyright © 2016 M/Gateway Developments Ltd Invoking a function var result = this.db.function({ function: 'myFunc^theRoutine', arguments: [ arg1, arg2] });
  6. Copyright © 2016 M/Gateway Developments Ltd Invoking a function Equivalent to: set result=$$myFunc^theRoutine(arg1,arg2) arguments must be scalar variables cannot pass values by reference result is a string (but could be stringified JSON) var result = this.db.function({ function: 'myFunc^theRoutine', arguments: [ arg1, arg2] });
  7. Copyright © 2016 M/Gateway Developments Ltd Accessing a Global Storage Database • We’ll now focus primarily on direct access to the Global Storage database
  8. Copyright © 2016 M/Gateway Developments Ltd Global Storage: The Basics
  9. Copyright © 2016 M/Gateway Developments Ltd Global Storage Databases • Three main ones – Caché from InterSystems • http://www.intersystems.com/our-products/cache/cache-overview/ • Proprietary commercial version for Windows, Linux, OS X – GT.M from FIS • https://www.fisglobal.com/Solutions/Services/Database-Engine • Free Open Source version for Linux – ewd-redis-globals • https://github.com/robtweed/ewd-redis-globals • Free, Open Source Redis-based implementation – Linux, Windows, Raspberry Pi • Multi-model NoSQL Database – All 3 implementations behave identically as Global Storage databases
  10. Copyright © 2016 M/Gateway Developments Ltd • Hierarchically structured
  11. Copyright © 2016 M/Gateway Developments Ltd • Hierarchically structured • Schema free
  12. Copyright © 2016 M/Gateway Developments Ltd • Hierarchically structured • Schema free • Sparse
  13. Copyright © 2016 M/Gateway Developments Ltd • Hierarchically structured • Schema free • Sparse • Dynamic
  14. Copyright © 2016 M/Gateway Developments Ltd Global Name
  15. Copyright © 2016 M/Gateway Developments Ltd Global Name Employee
  16. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Employee
  17. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) – alphanumeric Employee(123456, "name")
  18. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value Employee(123456, "name")
  19. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value - alphanumeric Employee(123456, "name") = "Rob Tweed"
  20. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value - alphanumeric Employee(123456, "name") = "Rob Tweed" Global Node
  21. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value - alphanumeric Employee(123456, "name") = "Rob Tweed" Global Node = unit of storage
  22. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value - alphanumeric Employee(123456, "name") = "Rob Tweed" Global Node = unit of storage An individual Global can contain 1 or more Global Nodes
  23. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value - alphanumeric Employee(123456, "name") = "Rob Tweed" Global Node = unit of storage An individual Global can contain 1 or more Global Nodes A Global Storage database can contain 1 or more Globals
  24. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value Dynamic – no pre-declaration or schema
  25. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value Dynamic – no pre-declaration or schema Create; Employee(123456, "name") = "Rob Tweed"
  26. Copyright © 2016 M/Gateway Developments Ltd Global Name Subscripts (0, 1 or more) Value Dynamic – no pre-declaration or schema Create; Employee(123456, "name") = "Rob Tweed" Delete: Employee(123456, "name")
  27. Copyright © 2016 M/Gateway Developments Ltd Hiearchical structure
  28. Copyright © 2016 M/Gateway Developments Ltd Hiearchical structure myGlobal("a")=123
  29. Copyright © 2016 M/Gateway Developments Ltd Hiearchical structure myGlobal("a")=123 myGlobal "a" 123
  30. Copyright © 2016 M/Gateway Developments Ltd Hiearchical structure myGlobal("a")=123 myGlobal("b","c1")="foo" myGlobal "a" 123
  31. Copyright © 2016 M/Gateway Developments Ltd Hiearchical structure myGlobal("a")=123 myGlobal("b","c1")="foo" myGlobal "a" 123 "b" "c1" "foo"
  32. Copyright © 2016 M/Gateway Developments Ltd Hiearchical structure myGlobal("a")=123 myGlobal("b","c1")="foo" myGlobal("b","c2")="foo2" myGlobal "a" 123 "b" "c1" "foo" "c2" "foo2"
  33. Copyright © 2016 M/Gateway Developments Ltd Hiearchical structure myGlobal("a")=123 myGlobal("b","c1")="foo" myGlobal("b","c2")="foo2" myGlobal("d","e1","f1")="bar1" myGlobal("d","e1","f2")="bar2" myGlobal("d","e2","f1")="bar1" myGlobal("d","e2","f2")="bar2" myGlobal("d","e2","f3")="bar3" myGlobal "a" 123 "b" "c2" "foo2" "d" "c1" "foo" "e2" "e1" "f2" "bar2" "f1" "bar1" "f2" "bar2" "f1" "bar1" "f3" "bar3"
  34. Copyright © 2016 M/Gateway Developments Ltd Deletion myGlobal("b","c1") myGlobal "a" 123 "b" "c2" "foo2" "d" "c1" "foo" "e2" "e1" "f2" "bar2" "f1" "bar1" "f2" "bar2" "f1" "bar1" "f3" "bar3"
  35. Copyright © 2016 M/Gateway Developments Ltd Deletion myGlobal("b") Deletes entire sub-tree of nodes! Take care!! myGlobal "a" 123 "b" "c2" "foo2" "d" "c1" "foo" "e2" "e1" "f2" "bar2" "f1" "bar1" "f2" "bar2" "f1" "bar1" "f3" "bar3"
Advertisement