Skip to content

Commit

Permalink
#341 add event_count to on_batch_notify functions
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Jul 10, 2018
1 parent c394d05 commit fa7a6ef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
20 changes: 10 additions & 10 deletions include/vstore/_binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
#define corto_mount_id(_this) _corto_mount_id(corto_mount(_this))
#define corto_mount_init(_this) _corto_mount_init(corto_mount(_this))
#define corto_mount_invoke(_this, instance, proc, argptrs) _corto_mount_invoke(corto_mount(_this), instance, corto_function(proc), argptrs)
#define corto_mount_on_batch_notify_v(_this, events) _corto_mount_on_batch_notify_v(corto_mount(_this), events)
#define corto_mount_on_history_batch_notify_v(_this, events) _corto_mount_on_history_batch_notify_v(corto_mount(_this), events)
#define corto_mount_on_batch_notify_v(_this, event_count, events) _corto_mount_on_batch_notify_v(corto_mount(_this), event_count, events)
#define corto_mount_on_history_batch_notify_v(_this, event_count, events) _corto_mount_on_history_batch_notify_v(corto_mount(_this), event_count, events)
#define corto_mount_on_history_query_v(_this, query) _corto_mount_on_history_query_v(corto_mount(_this), query)
#define corto_mount_on_id_v(_this) _corto_mount_on_id_v(corto_mount(_this))
#define corto_mount_on_invoke_v(_this, instance, proc, argptrs) _corto_mount_on_invoke_v(corto_mount(_this), instance, corto_function(proc), argptrs)
Expand Down Expand Up @@ -242,8 +242,8 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
#define safe_corto_mount_id(_this) _corto_mount_id(corto_mount(_this))
#define safe_corto_mount_init(_this) _corto_mount_init(corto_mount(_this))
#define safe_corto_mount_invoke(_this, instance, proc, argptrs) _corto_mount_invoke(corto_mount(_this), instance, corto_function(proc), argptrs)
#define safe_corto_mount_on_batch_notify_v(_this, events) _corto_mount_on_batch_notify_v(corto_mount(_this), events)
#define safe_corto_mount_on_history_batch_notify_v(_this, events) _corto_mount_on_history_batch_notify_v(corto_mount(_this), events)
#define safe_corto_mount_on_batch_notify_v(_this, event_count, events) _corto_mount_on_batch_notify_v(corto_mount(_this), event_count, events)
#define safe_corto_mount_on_history_batch_notify_v(_this, event_count, events) _corto_mount_on_history_batch_notify_v(corto_mount(_this), event_count, events)
#define safe_corto_mount_on_history_query_v(_this, query) _corto_mount_on_history_query_v(corto_mount(_this), query)
#define safe_corto_mount_on_id_v(_this) _corto_mount_on_id_v(corto_mount(_this))
#define safe_corto_mount_on_invoke_v(_this, instance, proc, argptrs) _corto_mount_on_invoke_v(corto_mount(_this), instance, corto_function(proc), argptrs)
Expand Down Expand Up @@ -314,15 +314,15 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
? ((_type_corto_resultIter (*)(corto_object, corto_query *))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_loader_on_query_o)->index - 1])->fptr)(corto_loader(_this), query) \
: *(corto_resultIter*)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_loader_on_query_o)->index - 1], alloca(sizeof(corto_resultIter)), corto_loader(_this), query) \
)
#define corto_mount_on_batch_notify(_this, events) ( \
#define corto_mount_on_batch_notify(_this, event_count, events) ( \
((corto_function)corto_mount_on_batch_notify_o)->kind == CORTO_PROCEDURE_CDECL \
? ((_type_corto_void (*)(corto_object, corto_subscriber_eventIter))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_batch_notify_o)->index - 1])->fptr)(corto_mount(_this), events) \
: (void)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_batch_notify_o)->index - 1], NULL, corto_mount(_this), events) \
? ((_type_corto_void (*)(corto_object, uint32_t, corto_subscriber_eventIter))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_batch_notify_o)->index - 1])->fptr)(corto_mount(_this), event_count, events) \
: (void)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_batch_notify_o)->index - 1], NULL, corto_mount(_this), event_count, events) \
)
#define corto_mount_on_history_batch_notify(_this, events) ( \
#define corto_mount_on_history_batch_notify(_this, event_count, events) ( \
((corto_function)corto_mount_on_history_batch_notify_o)->kind == CORTO_PROCEDURE_CDECL \
? ((_type_corto_void (*)(corto_object, corto_subscriber_eventIter))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_batch_notify_o)->index - 1])->fptr)(corto_mount(_this), events) \
: (void)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_batch_notify_o)->index - 1], NULL, corto_mount(_this), events) \
? ((_type_corto_void (*)(corto_object, uint32_t, corto_subscriber_eventIter))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_batch_notify_o)->index - 1])->fptr)(corto_mount(_this), event_count, events) \
: (void)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_batch_notify_o)->index - 1], NULL, corto_mount(_this), event_count, events) \
)
#define corto_mount_on_history_query(_this, query) ( \
((corto_function)corto_mount_on_history_query_o)->kind == CORTO_PROCEDURE_CDECL \
Expand Down
2 changes: 2 additions & 0 deletions include/vstore/_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ void _corto_mount_invoke(
CORTO_EXPORT
void _corto_mount_on_batch_notify_v(
corto_mount _this,
uint32_t event_count,
corto_subscriber_eventIter events);

CORTO_EXPORT
void _corto_mount_on_history_batch_notify_v(
corto_mount _this,
uint32_t event_count,
corto_subscriber_eventIter events);

CORTO_EXPORT
Expand Down
4 changes: 2 additions & 2 deletions src/store/bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1456,8 +1456,8 @@ CORTO_CLASS_O(vstore, mount, vstore_subscriber, CORTO_HIDDEN, CORTO_ATTR_DEFAULT
CORTO_OVERRIDABLE_O(vstore_mount, on_history_query, "(/corto/vstore/query query)", vstore_resultIter, corto_mount_on_history_query_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_resume, "(string parent,string id,inout:object object)", lang_int16, corto_mount_on_resume_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_notify, "(vstore/subscriber_event event)", lang_void, corto_mount_on_notify_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_batch_notify, "(vstore/subscriber_eventIter events)", lang_void, corto_mount_on_batch_notify_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_history_batch_notify, "(vstore/subscriber_eventIter events)", lang_void, corto_mount_on_batch_notify_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_batch_notify, "(uint32 event_count,vstore/subscriber_eventIter events)", lang_void, corto_mount_on_batch_notify_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_history_batch_notify, "(uint32 event_count,vstore/subscriber_eventIter events)", lang_void, corto_mount_on_batch_notify_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_subscribe, "(vstore/query query,lang/word ctx)", lang_word, corto_mount_on_subscribe_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_unsubscribe, "(vstore/query query,lang/word ctx)", lang_void, corto_mount_on_unsubscribe_v);
CORTO_OVERRIDABLE_O(vstore_mount, on_mount, "(vstore/query query,lang/word ctx)", lang_word, corto_mount_on_mount_v);
Expand Down
7 changes: 5 additions & 2 deletions src/vstore/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ void corto_mount_onPoll(
/* If batching is enabled, call on_batch_notify */
if (events && this->callbacks & CORTO_MOUNT_BATCH_NOTIFY) {
corto_iter it = corto_ll_iter(events);
corto_mount_on_batch_notify(this, it);
corto_mount_on_batch_notify(this, corto_ll_count(events), it);
}

/* If batching of historical data is enabled, call on_history_batch_notify */
if (historicalEvents && this->callbacks & CORTO_MOUNT_HISTORY_BATCH_NOTIFY) {
corto_iter it = corto_ll_iter(historicalEvents);
corto_mount_on_history_batch_notify(this, it);
corto_mount_on_history_batch_notify(this, corto_ll_count(historicalEvents), it);
it = corto_ll_iter(historicalEvents);
while (corto_iter_hasNext(&it)) {
corto_event *e = corto_iter_next(&it);
Expand Down Expand Up @@ -1478,9 +1478,11 @@ void corto_mount_on_unmount_v(

void corto_mount_on_batch_notify_v(
corto_mount this,
uint32_t event_count,
corto_subscriber_eventIter events)
{
CORTO_UNUSED(this);
CORTO_UNUSED(event_count);
CORTO_UNUSED(events);
}

Expand All @@ -1495,6 +1497,7 @@ corto_resultIter corto_mount_on_history_query_v(

void corto_mount_on_history_batch_notify_v(
corto_mount this,
uint32_t event_count,
corto_subscriber_eventIter events)
{
CORTO_UNUSED(this);
Expand Down

0 comments on commit fa7a6ef

Please sign in to comment.