Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Zero configuration graphql constructor for spaces with format #60

Closed
Totktonada opened this issue Feb 28, 2018 · 7 comments
Closed

Zero configuration graphql constructor for spaces with format #60

Totktonada opened this issue Feb 28, 2018 · 7 comments
Assignees
Labels
enhancement New feature or request prio3 usability

Comments

@Totktonada
Copy link
Member

No options — no connections. Ability to provide just connections, but any other metainfo to be retrieved from tarantool.

Related (but not the blocker): tarantool/tarantool#3080

@Totktonada Totktonada added enhancement New feature or request prio3 labels Feb 28, 2018
@Totktonada
Copy link
Member Author

I think we should enable such automatic configurators as generators of existing format of avro-schema, collections, sevice fields, indexes and so on to better decompose things to components.

@SudoBobo
Copy link
Contributor

SudoBobo commented Mar 20, 2018

I suggest to use the following constructor format:

tarantool_graphql.new(cfg)

where
cfg = { auto_cfg, schemas, collections, service_fields, indexes, accessor } - with the same meaning as earlier, execept accessor - now it may contain an accessor (as earlier) or a string with desired accessor type ('space' or 'shard' ) and auto_cfg - true or false - either auto generation should be done or not

And the following mechanism of construction:

  1. if auto_cfg is false then we use cfg as earlier.
  2. If auto_cfg is true then we produce cfg from tarantool metadata and try to merge it with passed cfg. There are two purposes of this merging:
    1. To complete cfg with fields that can't be currently produced from tarantool metadata
      (connections and nested elements of schema)
    2. To overwrite auto generated config with user written

@Totktonada
Copy link
Member Author

Consider the following usage:

tarantool> graphql = require('graphql') -- no new()
tarantool> graphql.cfg{...}
tarantool> graphql.execute('query ...')

@SudoBobo
Copy link
Contributor

SudoBobo commented Mar 21, 2018

@Totktonada Please check this mechanism of config generation.

  1. Generate cfg.schemas from space:format()
  2. Generate cfg.collections with no connections and names == schemas.names
  3. Generate cfg.indexes ({ collection_name = indexes } map ) using collections from step 2
  4. Merge generated config with user-written config (in case of overlapping, user-written config has higher prio) In his config user may provide additional fields for generated schemas (e.g. avro record or map fields)
  5. Complement cfg. Complement simplified user-written connections to standard connections
  6. Check that in resulting cfg all mentioned collections (in cfg.indexes, cfg.service_fields, etc) exist and. Similar checks on schemas

Also, what about service_fields? Can they be taken from tarantool?

@Totktonada
Copy link
Member Author

Okay.

  1. Note: merge arrays with named items per items by its names. Use field = box.NULL to delete an item. Configuration merger can be separate module.

Also, what about service_fields? Can they be taken from tarantool?

Nope, it always is empty for space format determined objects.

@Totktonada
Copy link
Member Author

@SudoBobo Can you please check whether this issue can be closed?

@SudoBobo
Copy link
Contributor

Closed with #95 .

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request prio3 usability
Projects
None yet
Development

No branches or pull requests

2 participants