tarantool / tarantool/doc

Document iproto override using event triggers

Open
#4,040 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.1 reference triggers
Dominant language
CSS
Stars
15
Forks
49
Avg merge
1d 13h
Merged PRs (30d)
3

Description

Related dev. issue(s): https://github.com/tarantool/tarantool/issues/8138

Product: Tarantool
Since: 3.1
Root document: a new trigger page in https://www.tarantool.io/en/doc/latest/reference/reference_lua/
SME: @ Gumix

Details

Since Tarantool 3.1 there are 2 ways to override iproto request handlers:

  1. Using box.iproto.override(), introduced in Tarantool 2.11:
    https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_iproto/override/

  2. Using universal trigger registry: tarantool/doc#3988

To override an iproto request handler for the given request type, one can
set a trigger (or multiple triggers) on the corresponding event.

There are 2 types of iproto-overriding events:

  1. set by request type id, e.g.:
    • box.iproto.override[1]
    • box.iproto.override[-1]
  2. set by request type name (the name must be in the lowercase), e.g.:
    • box.iproto.override.select
    • box.iproto.override.unknown

Override-by-id allows to set a handler for a particular request type, that
is not known by the given version of Tarantool. This is not possible with
override-by-name, where a type name must be known by Tarantool. Also there
are a special type name "unknown" and a type id box.iproto.type.UNKNOWN
(== -1) that allow to set a single handler for all unknown request types.

Multiple triggers can be associated with a single event. The triggers are
called in reverse order of their installation, however triggers set by id
are called before triggers set by name.

If a trigger returns false, the next trigger in the list is called, or a
system handler if there are no more triggers. If a trigger returns true,
no more triggers or system handlers are called.

If some request type is overridden by both interfaces (legacy
box.iproto.override() and new trigger.set()), the order of invocation
of those handlers is unspecified.

Requested by @ Gumix in https://github.com/tarantool/tarantool/commit/6fed99bc85d6f540e81dfa500e5bea37a616f5d6.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the new trigger page under the Lua reference and compare it with the existing box.iproto.override() documentation and related issue #8138. Document the two event forms, trigger ordering and return behavior, unknown request handling, and interaction with the legacy interface; done means the page covers the requested Tarantool 3.1 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.