Skip to content

Support IPROTO_PUSH #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kostja opened this issue Jun 23, 2018 · 5 comments · Fixed by #156
Closed

Support IPROTO_PUSH #67

kostja opened this issue Jun 23, 2018 · 5 comments · Fixed by #156
Assignees
Labels
feature A new functionality

Comments

@kostja
Copy link

kostja commented Jun 23, 2018

box.session.push() in 1.10 impements a new iproto command, IPROTO_PUSH. Please add support for it.

@funny-falcon
Copy link

yes, it will huge refactor. I will cobine it with new API.

@Totktonada Totktonada added 8sp feature A new functionality labels Dec 13, 2021
@unera
Copy link

unera commented Dec 13, 2021

IPROTO_PUSH is broken by desing.

  • The mechanism doesn't have back-pressure.
  • The mechanism has ugly semantic (session against request).
  • The mechanism has wrong API name (session.push against multireturn. This is misleading to users.)

I think that we should

  • drop API session.push
  • rework the API to multireturn (add back-pressure)
  • and then add the requests to Go connectors.

@unera unera added teamP and removed teamE labels Dec 13, 2021
@Totktonada
Copy link
Member

I agree that box.session.push() design has several flaws (or, okay, maybe it had some idea behind that was newer implemented).

Details are here: tarantool/tarantool#6107.

In my humble opinion IPROTO_PUSH support would be convenient for notifications about a long request status despite highlighted problems. Another point is that box.session.push() is available since tarantool 1.10.2, but anything new will be only in new tarantool versions.

Anyway, Dmitry asked for a pause to think and decide what is better to do here and, well, 'think than do' is better than vice versa :)

@Totktonada
Copy link
Member

NB: https://github.com/FZambia/tarantool supports box.session.push(), so we can look at the API.

@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Apr 4, 2022

We can add a stateful iterator with an interface

type ResponseIterator interface {
	Next() (bool)
	Value() (*Response)
	Err() (error)
}

and a function to get an interface implementation from the Future type:

func (fut *Future) GetIterator() ResponseIterator {
	// creates and returns an object of private type that implements ResponseIterator
}

Then a client-side code will look like this:

var fut *Future
var it ResponseIterator
var err error

fut = conn.CallAsync("server_function", []interface{}{})
for it = fut.GetIterator(); it.Next(); {
	resp := it.Value()
	if (resp.Code == PushCode) { // PushCode == IPROTO_PUSH == 0x80
		// push message
	} else {
		// regular response
	}
}
if err = it.Err(); err != nil {
	// an error happens
}

for it = fut.GetIterator().WithTimeout(1 * time.Second); it.Next(); {
	resp := it.Value()
	if (resp.Code == PushCode) { // PushCode == IPROTO_PUSH == 0x80
		// push message
	} else {
		// regular response
	}
}
if err = it.Err(); err != nil {
	// an error happens
}

The code handle an asynchronous case from a Lua implementation in the same way, see examples on Lua.

A synchronous case will require much more changes. If we try to extend the current implementation with additional functions for passing callbacks, it will not look very nice with a lot of duplication code. It seems to me that now it would be better to support only the asynchronous case.

@Totktonada Totktonada added teamE and removed teamP labels Apr 4, 2022
oleg-jukovec added a commit that referenced this issue Jun 14, 2022
This patch adds support for receiving messages sent using
box.session.push() via an iterator in the manner of asynchronous case
of a Lua implementation[1].

Now the calls Future.Get() and Future.GetTyped() ignore push messages,
and do not report an error.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/box_session/push/

Closes #67
oleg-jukovec added a commit that referenced this issue Jul 27, 2022
Overview

This release adds a number of features. The extending of the public API
has become possible with a new way of creating requests. New types of
requests are created via chain calls:

selectReq := NewSelectRequest("space").
             Context(ctx).
			 Index(1).
			 Offset(5).
			 Limit(10)
future := conn.Do(selectReq)

Streams, context and prepared statements support are based on this
idea:

stream, err := conn.NewStream()
beginReq := NewBeginRequest().Context(ctx)
if response, err := stream.Do(beginReq).Get(); err != nil {
    selectFuture := stream.Do(selectReq)
    commitFuture := stream.Do(NewCommitRequest())
    // ...
}
```

Breaking changes

    NewErrorFuture function removed (#190).

    `IPROTO_*` constants that identify requests renamed from
    `<Name>Request` to `<Name>RequestCode` (#126)

New features

    SSL support (#155).

    IPROTO_PUSH messages support (#67).

    Public API with request object types (#126).

    Support decimal type in msgpack (#96).

    Support datetime type in msgpack (#118).

    Prepared SQL statements (#117).

    Streams and interactive transactions support (#101).

    `Call16` method, support build tag `go_tarantool_call_17`
    to choose default behavior for `Call` method as Call17 (#125)

Bugfixes

    Add `ExecuteAsync` and `ExecuteTyped` to common connector
    interface (#62).
oleg-jukovec added a commit to tarantool/doc that referenced this issue Aug 2, 2022
Add context, streams, SQL and push messages support in Go connector

Follows up tarantool/go-tarantool#48
Follows up tarantool/go-tarantool#62
Follows up tarantool/go-tarantool#67
Follows up tarantool/go-tarantool#101
oleg-jukovec added a commit to tarantool/doc that referenced this issue Aug 2, 2022
Add context, streams, SQL and push messages support in Go connector

Follows up tarantool/go-tarantool#48
Follows up tarantool/go-tarantool#62
Follows up tarantool/go-tarantool#67
Follows up tarantool/go-tarantool#101
oleg-jukovec added a commit that referenced this issue Aug 2, 2022
Overview

This release adds a number of features. The extending of the public API
has become possible with a new way of creating requests. New types of
requests are created via chain calls:

selectReq := NewSelectRequest("space").
             Context(ctx).
			 Index(1).
			 Offset(5).
			 Limit(10)
future := conn.Do(selectReq)

Streams, context and prepared statements support are based on this
idea:

stream, err := conn.NewStream()
beginReq := NewBeginRequest().Context(ctx)
if response, err := stream.Do(beginReq).Get(); err != nil {
    selectFuture := stream.Do(selectReq)
    commitFuture := stream.Do(NewCommitRequest())
    // ...
}
```

Breaking changes

    NewErrorFuture function removed (#190).

    `IPROTO_*` constants that identify requests renamed from
    `<Name>Request` to `<Name>RequestCode` (#126)

New features

    SSL support (#155).

    IPROTO_PUSH messages support (#67).

    Public API with request object types (#126).

    Support decimal type in msgpack (#96).

    Support datetime type in msgpack (#118).

    Prepared SQL statements (#117).

    Streams and interactive transactions support (#101).

    `Call16` method, support build tag `go_tarantool_call_17`
    to choose default behavior for `Call` method as Call17 (#125)

Bugfixes

    Add `ExecuteAsync` and `ExecuteTyped` to common connector
    interface (#62).
oleg-jukovec added a commit that referenced this issue Aug 3, 2022
Overview

This release adds a number of features. The extending of the public API
has become possible with a new way of creating requests. New types of
requests are created via chain calls:

selectReq := NewSelectRequest("space").
             Context(ctx).
			 Index(1).
			 Offset(5).
			 Limit(10)
future := conn.Do(selectReq)

Streams, context and prepared statements support are based on this
idea:

stream, err := conn.NewStream()
beginReq := NewBeginRequest().Context(ctx)
if response, err := stream.Do(beginReq).Get(); err != nil {
    selectFuture := stream.Do(selectReq)
    commitFuture := stream.Do(NewCommitRequest())
    // ...
}
```

Breaking changes

    NewErrorFuture function removed (#190).

    `IPROTO_*` constants that identify requests renamed from
    `<Name>Request` to `<Name>RequestCode` (#126)

New features

    SSL support (#155).

    IPROTO_PUSH messages support (#67).

    Public API with request object types (#126).

    Support decimal type in msgpack (#96).

    Support datetime type in msgpack (#118).

    Prepared SQL statements (#117).

	Context support for request objects (#48).

    Streams and interactive transactions support (#101).

    `Call16` method, support build tag `go_tarantool_call_17`
    to choose default behavior for `Call` method as Call17 (#125)

Bugfixes

    Add `ExecuteAsync` and `ExecuteTyped` to common connector
    interface (#62).
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
Overview

This release adds a number of features. The extending of the public API
has become possible with a new way of creating requests. New types of
requests are created via chain calls:

selectReq := NewSelectRequest("space").
             Context(ctx).
			 Index(1).
			 Offset(5).
			 Limit(10)
future := conn.Do(selectReq)

Streams, context and prepared statements support are based on this
idea:

stream, err := conn.NewStream()
beginReq := NewBeginRequest().Context(ctx)
if response, err := stream.Do(beginReq).Get(); err != nil {
    selectFuture := stream.Do(selectReq)
    commitFuture := stream.Do(NewCommitRequest())
    // ...
}
```

Breaking changes

    NewErrorFuture function removed (#190).

    `IPROTO_*` constants that identify requests renamed from
    `<Name>Request` to `<Name>RequestCode` (#126)

New features

    SSL support (#155).

    IPROTO_PUSH messages support (#67).

    Public API with request object types (#126).

    Support decimal type in msgpack (#96).

    Support datetime type in msgpack (#118).

    Prepared SQL statements (#117).

	Context support for request objects (#48).

    Streams and interactive transactions support (#101).

    `Call16` method, support build tag `go_tarantool_call_17`
    to choose default behavior for `Call` method as Call17 (#125)

Bugfixes

    Add `ExecuteAsync` and `ExecuteTyped` to common connector
    interface (#62).
oleg-jukovec added a commit that referenced this issue Aug 4, 2022
Overview

This release adds a number of features. The extending of the public API
has become possible with a new way of creating requests. New types of
requests are created via chain calls:

selectReq := NewSelectRequest("space").
             Context(ctx).
             Index(1).
             Offset(5).
             Limit(10)
future := conn.Do(selectReq)

Streams, context and prepared statements support are based on this
idea:

stream, err := conn.NewStream()
beginReq := NewBeginRequest().Context(ctx)
if response, err := stream.Do(beginReq).Get(); err != nil {
    selectFuture := stream.Do(selectReq)
    commitFuture := stream.Do(NewCommitRequest())
    // ...
}
```

Breaking changes

    NewErrorFuture function removed (#190).

    `IPROTO_*` constants that identify requests renamed from
    `<Name>Request` to `<Name>RequestCode` (#126)

New features

    SSL support (#155).

    IPROTO_PUSH messages support (#67).

    Public API with request object types (#126).

    Support decimal type in msgpack (#96).

    Support datetime type in msgpack (#118).

    Prepared SQL statements (#117).

    Context support for request objects (#48).

    Streams and interactive transactions support (#101).

    `Call16` method, support build tag `go_tarantool_call_17`
    to choose default behavior for `Call` method as Call17 (#125)

Bugfixes

    Add `ExecuteAsync` and `ExecuteTyped` to common connector
    interface (#62).
oleg-jukovec added a commit to tarantool/doc that referenced this issue Aug 15, 2022
The patch adds context, streams, SQL, push messages and master
discovery support for connection pool to go-tarantool. It also updates
GitHub starts for Go connectors.

Follows up tarantool/go-tarantool#48
Follows up tarantool/go-tarantool#62
Follows up tarantool/go-tarantool#67
Follows up tarantool/go-tarantool#101
Follows up tarantool/go-tarantool#113
patiencedaur pushed a commit to tarantool/doc that referenced this issue Aug 15, 2022
Resolves #3094 

The patch adds context, streams, SQL, push messages and master
discovery support for connection pool to go-tarantool. It also updates
GitHub starts for Go connectors.

Follows up tarantool/go-tarantool#48
Follows up tarantool/go-tarantool#62
Follows up tarantool/go-tarantool#67
Follows up tarantool/go-tarantool#101
Follows up tarantool/go-tarantool#113
@oleg-jukovec oleg-jukovec mentioned this issue Dec 13, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants