Skip to content
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

Support watchers (subscription to server events) #119

Closed
Totktonada opened this issue Dec 13, 2021 · 6 comments · Fixed by #230
Closed

Support watchers (subscription to server events) #119

Totktonada opened this issue Dec 13, 2021 · 6 comments · Fixed by #230
Assignees
Labels
feature A new functionality

Comments

@Totktonada
Copy link
Member

Protocol: tarantool/doc#2408.
net.box API (as a reference API): tarantool/doc#2409.

@Totktonada Totktonada added teamE feature A new functionality labels Dec 13, 2021
@oleg-jukovec oleg-jukovec self-assigned this Nov 2, 2022
@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Nov 2, 2022

API proposal

The Watcher interface will be part of Connector interface (will be needed to simplify the code and for mocking in tests):

type Watcher interface {
    Watch(c chan<- *WatchEvent, key string) error
    Unwatch(key string) error
}

The event type in the main package:

type WatchEvent struct {
    Value interface{}
}

The event type in the connection_pool package:

// PoolWatchEvent extends type WatchEvent. It can be used in the code that knows about
// the ConnectionPool, but not necessary for other code.
type PoolWatchEvent struct {
     WatchEvent
     Conn *Connection
}

The Watch/Unwatch calls for Connector/Connection/ConnectionPool/ConnectionMulti:

// Watch creates a watch for the key. All incoming events for this key will be relay to c.
// Event will not block sending to c: the caller must ensure that c has sufficient buffer space to keep
// up with the expected event rate or some events may be missed. 
func Watch(c chan<- *WatchEvent, key string) error
// Unwatch removes a watch for the key.
func Unwatch(c chan<- *WatchEvent, key string) error

An example:

go func(done <-chan struct{}) {
    events := make(chan *tarantool.WatchEvent, 128)
    defer close(events)

    // conn is instance of Connector
    conn.Watch(events, key)
    defer conn.Unwatch(events, key)

    // create/init done channel
    for {
        select{
            case <- done: // or check event from Connection.Opts.Notify for the Closed event
                return
            case e := <-events:
                fmt.Println("Get value", e.Value)
                if e, ok := e.(*connection_pool.PoolWatchEvent); ok {
                    fmt.Println("Connected to:", e.Conn.Addr())
                }
         }
    }
}(done)

@R-omk
Copy link

R-omk commented Nov 2, 2022

the caller must ensure that c has sufficient buffer space

In addition to that, I would prefer that one last event is always kept independently of channel.

@R-omk
Copy link

R-omk commented Nov 2, 2022

Since one key can be subscribed only once, I think it is necessary to separate the fact of subscription from recipients. Register recipients separately from the subscription object.
Additionally, you can make a method that returns the latest event, without having to subscribe to the entire event stream.

@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Nov 2, 2022

Thank you for the feedback!

In addition to that, I would prefer that one last event is always kept independently of channel.

Could you provide a usage case, please? I did not quite understand when it will be useful.

Since one key can be subscribed only once, I think it is necessary to separate the fact of subscription from recipients.

The idea includes to subscribe to one key for multiple channels. So the code will be valid for the proposal API:

conn.Watch(channel1, "foo")
conn.Watch(channel2, "foo")
// Аfter the "foo" update, the event will be sent to channel1 and channel2.

I think that should work or I miss something?

@R-omk
Copy link

R-omk commented Nov 2, 2022

It's best to make the behavior as similar as possible to the native implementation in net.box,

https://github.com/tarantool/tarantool/blob/05cce2862787d0155f1393ecd2de74a4c7e017eb/src/box/lua/net_box.lua#L571-L713

omissions of events are possible here, but the last one will always be sent.

@oleg-jukovec
Copy link
Collaborator

Thank you. I'll think about it a bit more and propose another API in a week.

oleg-jukovec added a commit that referenced this issue Nov 17, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
		// The callback code.
	})

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

	watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 17, 2022
WIP: ConnectionPool/ConnectionMulti

A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
		// The callback code.
	})

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

	watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 21, 2022
WIP: ConnectionPool/ConnectionMulti

A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 21, 2022
WIP: ConnectionPool/ConnectionMulti

A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 21, 2022
WIP: ConnectionPool/ConnectionMulti

A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 22, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 22, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 22, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 22, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 22, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 22, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/ru/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 23, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 24, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 24, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 24, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 24, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 30, 2022
The patch removes a last newline character from log messages because
the character will be added anyway [1][2].

1. https://pkg.go.dev/log#Logger.Printf
2. https://pkg.go.dev/log#Output

Part of #119
oleg-jukovec added a commit that referenced this issue Nov 30, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 30, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 30, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 30, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 30, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Nov 30, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Dec 5, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Dec 5, 2022
The patch removes a last newline character from log messages because
the character will be added anyway [1][2].

1. https://pkg.go.dev/log#Logger.Printf
2. https://pkg.go.dev/log#Output

Part of #119
oleg-jukovec added a commit that referenced this issue Dec 5, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Dec 5, 2022
The patch removes a last newline character from log messages because
the character will be added anyway [1][2].

1. https://pkg.go.dev/log#Logger.Printf
2. https://pkg.go.dev/log#Output

Part of #119
oleg-jukovec added a commit that referenced this issue Dec 5, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Dec 6, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Dec 6, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Dec 7, 2022
The patch removes a last newline character from log messages because
the character will be added anyway [1][2].

1. https://pkg.go.dev/log#Logger.Printf
2. https://pkg.go.dev/log#Output

Part of #119
oleg-jukovec added a commit that referenced this issue Dec 7, 2022
A user can create watcher by the Connection.NewWatcher() call:

    watcher = conn.NewWatcker("key", func(event WatchEvent) {
        // The callback code.
    })

After that, the watcher callback is invoked for the first time. In
this case, the callback is triggered whether or not the key has
already been broadcast. All subsequent invocations are triggered with
box.broadcast() called on the remote host. If a watcher is subscribed
for a key that has not been broadcast yet, the callback is triggered
only once, after the registration of the watcher.

If the key is updated while the watcher callback is running, the
callback will be invoked again with the latest value as soon as it
returns.

Multiple watchers can be created for one key.

If you don’t need the watcher anymore, you can unregister it using
the Unregister method:

    watcher.Unregister()

The api is similar to net.box implementation [1].

It also adds a BroadcastRequest to make it easier to send broadcast
messages.

1. https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#conn-watch

Closes #119
oleg-jukovec added a commit that referenced this issue Dec 7, 2022
The patch removes a last newline character from log messages because
the character will be added anyway [1][2].

1. https://pkg.go.dev/log#Logger.Printf
2. https://pkg.go.dev/log#Output

Part of #119
DifferentialOrange added a commit that referenced this issue Dec 13, 2022
Use skipIfLess helpers like in other test conditions.

Follows #119
DifferentialOrange added a commit that referenced this issue Dec 13, 2022
Use skipIfLess helpers like in other test conditions.

Follows #119
oleg-jukovec pushed a commit that referenced this issue Dec 21, 2022
Use skipIfLess helpers like in other test conditions.

Follows #119
oleg-jukovec added a commit that referenced this issue Dec 28, 2022
Overview

    The release improves compatibility with new Tarantool versions.

Breaking changes

    There are no breaking changes in the release.

New features

    Support iproto feature discovery (#120).

    Support errors extended information (#209).

    Support error type in MessagePack (#209).

    Support event subscriptin (#119).

    Support session settings (#215).

    Support pap-sha256 authorization method (Tarantool EE
    feature) (#243).

    Support graceful shutdown (#214).

Bugfixes

    Decimal package uses a test variable DecimalPrecision instead
    of a package-level variable decimalPrecision (#233).

    Flaky test TestClientRequestObjectsWithContext (#244).

    Flaky test multi/TestDisconnectAll (#234).
oleg-jukovec added a commit that referenced this issue Dec 29, 2022
Overview

    The release improves compatibility with new Tarantool versions.

Breaking changes

    There are no breaking changes in the release.

New features

    Support iproto feature discovery (#120).

    Support errors extended information (#209).

    Support error type in MessagePack (#209).

    Support event subscription (#119).

    Support session settings (#215).

    Support pap-sha256 authorization method (Tarantool EE
    feature) (#243).

    Support graceful shutdown (#214).

Bugfixes

    Decimal package uses a test variable DecimalPrecision instead
    of a package-level variable decimalPrecision (#233).

    Flaky test TestClientRequestObjectsWithContext (#244).

    Flaky test multi/TestDisconnectAll (#234).
oleg-jukovec added a commit that referenced this issue Dec 30, 2022
Overview

    The release improves compatibility with new Tarantool versions.

Breaking changes

    There are no breaking changes in the release.

New features

    Support iproto feature discovery (#120).

    Support errors extended information (#209).

    Support error type in MessagePack (#209).

    Support event subscription (#119).

    Support session settings (#215).

    Support pap-sha256 authorization method (Tarantool EE
    feature) (#243).

    Support graceful shutdown (#214).

Bugfixes

    Decimal package uses a test variable DecimalPrecision instead
    of a package-level variable decimalPrecision (#233).

    Flaky test TestClientRequestObjectsWithContext (#244).

    Flaky test multi/TestDisconnectAll (#234).
pull bot pushed a commit to kokizzu/go-tarantool that referenced this issue Jan 1, 2023
Overview

    The release improves compatibility with new Tarantool versions.

Breaking changes

    There are no breaking changes in the release.

New features

    Support iproto feature discovery (tarantool#120).

    Support errors extended information (tarantool#209).

    Support error type in MessagePack (tarantool#209).

    Support event subscription (tarantool#119).

    Support session settings (tarantool#215).

    Support pap-sha256 authorization method (Tarantool EE
    feature) (tarantool#243).

    Support graceful shutdown (tarantool#214).

Bugfixes

    Decimal package uses a test variable DecimalPrecision instead
    of a package-level variable decimalPrecision (tarantool#233).

    Flaky test TestClientRequestObjectsWithContext (tarantool#244).

    Flaky test multi/TestDisconnectAll (tarantool#234).
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.

3 participants