public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] Alfred update-command
@ 2015-10-04 14:23 Dominik Heidler
  2015-10-04 16:17 ` Sven Eckelmann
  0 siblings, 1 reply; 6+ messages in thread
From: Dominik Heidler @ 2015-10-04 14:23 UTC (permalink / raw)
  To: b.a.t.m.a.n

Hi,

I tried to use the alfred update-command but it seems that the
update-command is only triggered when data is purged but not when new
data is received.

The changed_data_type() method is only called from the purge_data() method.

169     while (NULL != (hashit = hash_iterate(globals->data_hash,
hashit))) {
170         struct dataset *dataset = hashit->bucket->data;
171
172         time_diff(&now, &dataset->last_seen, &diff);
173         if (diff.tv_sec < ALFRED_DATA_TIMEOUT)
174             continue;
175
176         changed_data_type(globals, dataset->data.header.type);

177
178         hash_remove_bucket(globals->data_hash, hashit);
179         free(dataset->buf);
180         free(dataset);
181     }


Is this the way the update-command should work or am I doing something
wrong?

Regards,
Dominik Heidler

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] Alfred update-command
  2015-10-04 14:23 [B.A.T.M.A.N.] Alfred update-command Dominik Heidler
@ 2015-10-04 16:17 ` Sven Eckelmann
  2015-10-04 16:22   ` Dominik Heidler
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Eckelmann @ 2015-10-04 16:17 UTC (permalink / raw)
  To: Anatoliy Lapitskiy, Dominik Heidler; +Cc: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]

On Sunday 04 October 2015 16:23:28 Dominik Heidler wrote:
> Hi,
> 
> I tried to use the alfred update-command but it seems that the
> update-command is only triggered when data is purged but not when new
> data is received.
> 
> The changed_data_type() method is only called from the purge_data() method.
[...]

Nope, see finish_alfred_push_data (when data was synced to a master node):

		/* check that data was changed */
		if (new_entry_created ||
		    dataset->data.header.length != data_len ||
		    memcmp(dataset->buf, data->data, data_len) != 0)
			changed_data_type(globals, data->header.type);

It is useless on slave instances because they only pull data when it is 
required. But better ask Anatoliy because he is creator of this feature and 
the only one I know who seems to use it.

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] Alfred update-command
  2015-10-04 16:17 ` Sven Eckelmann
@ 2015-10-04 16:22   ` Dominik Heidler
  2015-10-04 16:27     ` Sven Eckelmann
  0 siblings, 1 reply; 6+ messages in thread
From: Dominik Heidler @ 2015-10-04 16:22 UTC (permalink / raw)
  To: Sven Eckelmann, Anatoliy Lapitskiy; +Cc: b.a.t.m.a.n

Hi,

ah so the update hook is only executed, when the master gets the data update via UDP.
In my testsetup I updated the master data directly via Unix socket on  the master.

Regards,
Dominik

Am 4. Oktober 2015 18:17:56 MESZ, schrieb Sven Eckelmann <sven@narfation.org>:
>On Sunday 04 October 2015 16:23:28 Dominik Heidler wrote:
>> Hi,
>> 
>> I tried to use the alfred update-command but it seems that the
>> update-command is only triggered when data is purged but not when new
>> data is received.
>> 
>> The changed_data_type() method is only called from the purge_data()
>method.
>[...]
>
>Nope, see finish_alfred_push_data (when data was synced to a master
>node):
>
>		/* check that data was changed */
>		if (new_entry_created ||
>		    dataset->data.header.length != data_len ||
>		    memcmp(dataset->buf, data->data, data_len) != 0)
>			changed_data_type(globals, data->header.type);
>
>It is useless on slave instances because they only pull data when it is
>
>required. But better ask Anatoliy because he is creator of this feature
>and 
>the only one I know who seems to use it.
>
>Kind regards,
>	Sven


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] Alfred update-command
  2015-10-04 16:22   ` Dominik Heidler
@ 2015-10-04 16:27     ` Sven Eckelmann
  2015-10-04 16:30       ` Dominik Heidler
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Eckelmann @ 2015-10-04 16:27 UTC (permalink / raw)
  To: Dominik Heidler; +Cc: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

On Sunday 04 October 2015 18:22:54 Dominik Heidler wrote:
> ah so the update hook is only executed, when the master gets the data update
> via UDP. In my testsetup I updated the master data directly via Unix socket
> on  the master.

Correct. Usually you don't need to inform the local  system that the system 
itself updated the state of the alfred data :)

But feel free to discuss it with Anatoliy here on the mailing list (so we can 
follow the pros/cons of a design change).

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] Alfred update-command
  2015-10-04 16:27     ` Sven Eckelmann
@ 2015-10-04 16:30       ` Dominik Heidler
  2015-10-04 16:46         ` Sven Eckelmann
  0 siblings, 1 reply; 6+ messages in thread
From: Dominik Heidler @ 2015-10-04 16:30 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n

Is the hook executed as well when the data is pushed from another master node?

Regards,
Dominik

Am 4. Oktober 2015 18:27:54 MESZ, schrieb Sven Eckelmann <sven@narfation.org>:
>On Sunday 04 October 2015 18:22:54 Dominik Heidler wrote:
>> ah so the update hook is only executed, when the master gets the data
>update
>> via UDP. In my testsetup I updated the master data directly via Unix
>socket
>> on  the master.
>
>Correct. Usually you don't need to inform the local  system that the
>system 
>itself updated the state of the alfred data :)
>
>But feel free to discuss it with Anatoliy here on the mailing list (so
>we can 
>follow the pros/cons of a design change).
>
>Kind regards,
>	Sven


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] Alfred update-command
  2015-10-04 16:30       ` Dominik Heidler
@ 2015-10-04 16:46         ` Sven Eckelmann
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Eckelmann @ 2015-10-04 16:46 UTC (permalink / raw)
  To: Dominik Heidler; +Cc: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On Sunday 04 October 2015 18:30:48 Dominik Heidler wrote:
> Is the hook executed as well when the data is pushed from another master
> node?

Master-2-Master syncs also go through the function finish_alfred_push_data 
when the sync was completed successfully. So this hook should also be called 
in Anatoliy's implementation. It is basically the idea behind it.

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-04 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-04 14:23 [B.A.T.M.A.N.] Alfred update-command Dominik Heidler
2015-10-04 16:17 ` Sven Eckelmann
2015-10-04 16:22   ` Dominik Heidler
2015-10-04 16:27     ` Sven Eckelmann
2015-10-04 16:30       ` Dominik Heidler
2015-10-04 16:46         ` Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox