Skip to content

Commit

Permalink
#341 rename result to record
Browse files Browse the repository at this point in the history
The corto/vstore/result identifier was used for the type that describes
objects that do not live in the in-memory store. “result” is too
generic though, and it doesn’t describe well what its function is (when
used in a subscriber, nothing is “returned”). Therefore the typename is
changed to “record”, which is more appropriate.
  • Loading branch information
SanderMertens committed Jul 10, 2018
1 parent f7e92c6 commit 4468af6
Show file tree
Hide file tree
Showing 49 changed files with 781 additions and 781 deletions.
148 changes: 74 additions & 74 deletions c/include/vstore.h

Large diffs are not rendered by default.

164 changes: 82 additions & 82 deletions c/src/vstore.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/lang/_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ CORTO_META_OBJECT(sequence, interfaceseq);
CORTO_META_OBJECT(sequence, stringseq);
CORTO_META_OBJECT(sequence, int32seq);
CORTO_META_OBJECT(sequence, wordseq);
CORTO_META_OBJECT(list, resultList);
CORTO_META_OBJECT(list, recordList);
CORTO_META_OBJECT(list, objectlist);
CORTO_META_OBJECT(list, taglist);
CORTO_META_OBJECT(list, stringlist);
Expand Down
4 changes: 2 additions & 2 deletions include/store/fmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ CORTO_EXPORT
void* corto_fmt_from_result(
corto_fmt fmt,
corto_fmt_opt *opt,
corto_result *result);
corto_record *result);

CORTO_EXPORT
int16_t corto_fmt_to_result(
corto_fmt fmt,
corto_fmt_opt *opt,
corto_result *result,
corto_record *result,
const void *data);

CORTO_EXPORT
Expand Down
46 changes: 23 additions & 23 deletions include/vstore/_binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
#define corto_observer_event(o) ((corto_observer_event*)corto_assert_type((corto_type)corto_observer_event_o, o))
#define corto_operatorKind(o) ((corto_operatorKind*)corto_assert_type((corto_type)corto_operatorKind_o, o))
#define corto_remote(o) ((corto_remote)corto_assert_type((corto_type)corto_remote_o, o))
#define corto_resultMask(o) ((corto_resultMask*)corto_assert_type((corto_type)corto_resultMask_o, o))
#define corto_recordMask(o) ((corto_recordMask*)corto_assert_type((corto_type)corto_recordMask_o, o))
#define corto_sample(o) ((corto_sample*)corto_assert_type((corto_type)corto_sample_o, o))
#define corto_sampleIter(o) ((corto_sampleIter*)corto_assert_type((corto_type)corto_sampleIter_o, o))
#define corto_result(o) ((corto_result*)corto_assert_type((corto_type)corto_result_o, o))
#define corto_resultIter(o) ((corto_resultIter*)corto_assert_type((corto_type)corto_resultIter_o, o))
#define corto_resultlist(o) ((corto_resultlist*)corto_assert_type((corto_type)corto_resultlist_o, o))
#define corto_record(o) ((corto_record*)corto_assert_type((corto_type)corto_record_o, o))
#define corto_recordIter(o) ((corto_recordIter*)corto_assert_type((corto_type)corto_recordIter_o, o))
#define corto_recordlist(o) ((corto_recordlist*)corto_assert_type((corto_type)corto_recordlist_o, o))
#define corto_route(o) ((corto_route)corto_assert_type((corto_type)corto_route_o, o))
#define corto_router(o) ((corto_router)corto_assert_type((corto_type)corto_router_o, o))
#define corto_routerimpl(o) ((corto_routerimpl)corto_assert_type((corto_type)corto_routerimpl_o, o))
Expand Down Expand Up @@ -63,12 +63,12 @@ typedef corto_objectIter _type_corto_objectIter;
typedef corto_observer_event _type_corto_observer_event;
typedef corto_operatorKind _type_corto_operatorKind;
typedef corto_remote _type_corto_remote;
typedef corto_resultMask _type_corto_resultMask;
typedef corto_recordMask _type_corto_recordMask;
typedef corto_sample _type_corto_sample;
typedef corto_sampleIter _type_corto_sampleIter;
typedef corto_result _type_corto_result;
typedef corto_resultIter _type_corto_resultIter;
typedef corto_resultlist _type_corto_resultlist;
typedef corto_record _type_corto_record;
typedef corto_recordIter _type_corto_recordIter;
typedef corto_recordlist _type_corto_recordlist;
typedef corto_route _type_corto_route;
typedef corto_router _type_corto_router;
typedef corto_routerimpl _type_corto_routerimpl;
Expand Down Expand Up @@ -128,9 +128,9 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
#define corto_observer_event_init(_this) _corto_observer_event_init(_this)
#define corto_query_cardinality(_this) _corto_query_cardinality(_this)
#define corto_query_match(_this, result) _corto_query_match(_this, result)
#define corto_result_contentof(_this, format) _corto_result_contentof(_this, format)
#define corto_result_fromcontent(_this, format, content) _corto_result_fromcontent(_this, format, content)
#define corto_result_get_text(_this) _corto_result_get_text(_this)
#define corto_record_contentof(_this, format) _corto_record_contentof(_this, format)
#define corto_record_fromcontent(_this, format, content) _corto_record_fromcontent(_this, format, content)
#define corto_record_get_text(_this) _corto_record_get_text(_this)
#define corto_route_construct(_this) _corto_route_construct(corto_route(_this))
#define corto_route_init(_this) _corto_route_init(corto_route(_this))
#define corto_router_construct(_this) _corto_router_construct(corto_router(_this))
Expand Down Expand Up @@ -204,9 +204,9 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
#define corto_observer_event_init _corto_observer_event_init
#define corto_query_cardinality _corto_query_cardinality
#define corto_query_match _corto_query_match
#define corto_result_contentof _corto_result_contentof
#define corto_result_fromcontent _corto_result_fromcontent
#define corto_result_get_text _corto_result_get_text
#define corto_record_contentof _corto_record_contentof
#define corto_record_fromcontent _corto_record_fromcontent
#define corto_record_get_text _corto_record_get_text
#define corto_route_construct _corto_route_construct
#define corto_route_init _corto_route_init
#define corto_router_construct _corto_router_construct
Expand Down Expand Up @@ -278,9 +278,9 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
#define safe_corto_observer_event_init(_this) _corto_observer_event_init(_this)
#define safe_corto_query_cardinality(_this) _corto_query_cardinality(_this)
#define safe_corto_query_match(_this, result) _corto_query_match(_this, result)
#define safe_corto_result_contentof(_this, format) _corto_result_contentof(_this, format)
#define safe_corto_result_fromcontent(_this, format, content) _corto_result_fromcontent(_this, format, content)
#define safe_corto_result_get_text(_this) _corto_result_get_text(_this)
#define safe_corto_record_contentof(_this, format) _corto_record_contentof(_this, format)
#define safe_corto_record_fromcontent(_this, format, content) _corto_record_fromcontent(_this, format, content)
#define safe_corto_record_get_text(_this) _corto_record_get_text(_this)
#define safe_corto_route_construct(_this) _corto_route_construct(corto_route(_this))
#define safe_corto_route_init(_this) _corto_route_init(corto_route(_this))
#define safe_corto_router_construct(_this) _corto_router_construct(corto_router(_this))
Expand Down Expand Up @@ -311,8 +311,8 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
)
#define corto_loader_on_query(_this, query) ( \
((corto_function)corto_loader_on_query_o)->kind == CORTO_PROCEDURE_CDECL \
? ((_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) \
? ((_type_corto_recordIter (*)(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_recordIter*)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_loader_on_query_o)->index - 1], alloca(sizeof(corto_recordIter)), corto_loader(_this), query) \
)
#define corto_mount_on_batch_notify(_this, event_count, events) ( \
((corto_function)corto_mount_on_batch_notify_o)->kind == CORTO_PROCEDURE_CDECL \
Expand All @@ -326,8 +326,8 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
)
#define corto_mount_on_history_query(_this, query) ( \
((corto_function)corto_mount_on_history_query_o)->kind == CORTO_PROCEDURE_CDECL \
? ((_type_corto_resultIter (*)(corto_object, corto_query *))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_query_o)->index - 1])->fptr)(corto_mount(_this), query) \
: *(corto_resultIter*)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_query_o)->index - 1], alloca(sizeof(corto_resultIter)), corto_mount(_this), query) \
? ((_type_corto_recordIter (*)(corto_object, corto_query *))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_query_o)->index - 1])->fptr)(corto_mount(_this), query) \
: *(corto_recordIter*)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_history_query_o)->index - 1], alloca(sizeof(corto_recordIter)), corto_mount(_this), query) \
)
#define corto_mount_on_id(_this) ( \
((corto_function)corto_mount_on_id_o)->kind == CORTO_PROCEDURE_CDECL \
Expand All @@ -351,8 +351,8 @@ typedef corto_subscriber_eventIter _type_corto_subscriber_eventIter;
)
#define corto_mount_on_query(_this, query) ( \
((corto_function)corto_mount_on_query_o)->kind == CORTO_PROCEDURE_CDECL \
? ((_type_corto_resultIter (*)(corto_object, corto_query *))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_query_o)->index - 1])->fptr)(corto_mount(_this), query) \
: *(corto_resultIter*)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_query_o)->index - 1], alloca(sizeof(corto_resultIter)), corto_mount(_this), query) \
? ((_type_corto_recordIter (*)(corto_object, corto_query *))((corto_function)((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_query_o)->index - 1])->fptr)(corto_mount(_this), query) \
: *(corto_recordIter*)corto_invoke(((corto_interface)corto_typeof(_this))->methods.buffer[((corto_method)corto_mount_on_query_o)->index - 1], alloca(sizeof(corto_recordIter)), corto_mount(_this), query) \
)
#define corto_mount_on_resume(_this, parent, id, object) ( \
((corto_function)corto_mount_on_resume_o)->kind == CORTO_PROCEDURE_CDECL \
Expand Down
28 changes: 14 additions & 14 deletions include/vstore/_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void _corto_loader_destruct(
corto_loader _this);

CORTO_EXPORT
corto_resultIter _corto_loader_on_query_v(
corto_recordIter _corto_loader_on_query_v(
corto_loader _this,
corto_query *query);

Expand All @@ -84,7 +84,7 @@ void _corto_mount_destruct(
corto_mount _this);

CORTO_EXPORT
corto_resultIter _corto_mount_historyQuery(
corto_recordIter _corto_mount_historyQuery(
corto_mount _this,
corto_query *query);

Expand Down Expand Up @@ -116,7 +116,7 @@ void _corto_mount_on_history_batch_notify_v(
corto_subscriber_eventIter events);

CORTO_EXPORT
corto_resultIter _corto_mount_on_history_query_v(
corto_recordIter _corto_mount_on_history_query_v(
corto_mount _this,
corto_query *query);

Expand All @@ -143,7 +143,7 @@ void _corto_mount_on_notify_v(
corto_subscriber_event *event);

CORTO_EXPORT
corto_resultIter _corto_mount_on_query_v(
corto_recordIter _corto_mount_on_query_v(
corto_mount _this,
corto_query *query);

Expand Down Expand Up @@ -201,7 +201,7 @@ void _corto_mount_publish(
uintptr_t value);

CORTO_EXPORT
corto_resultIter _corto_mount_query(
corto_recordIter _corto_mount_query(
corto_mount _this,
corto_query *query);

Expand All @@ -215,7 +215,7 @@ int16_t _corto_mount_resume(
CORTO_EXPORT
void _corto_mount_return(
corto_mount _this,
corto_result *r);
corto_record *r);

CORTO_EXPORT
int16_t _corto_mount_set_format(
Expand Down Expand Up @@ -300,25 +300,25 @@ uint32_t _corto_query_cardinality(
CORTO_EXPORT
bool _corto_query_match(
corto_query* _this,
corto_result *result);
corto_record *result);


/* struct corto/vstore/result */
/* struct corto/vstore/record */

CORTO_EXPORT
corto_string _corto_result_contentof(
corto_result* _this,
corto_string _corto_record_contentof(
corto_record* _this,
const char *format);

CORTO_EXPORT
int16_t _corto_result_fromcontent(
corto_result* _this,
int16_t _corto_record_fromcontent(
corto_record* _this,
const char *format,
const char *content);

CORTO_EXPORT
corto_string _corto_result_get_text(
corto_result* _this);
corto_string _corto_record_get_text(
corto_record* _this);


/* procedure corto/vstore/route */
Expand Down
8 changes: 4 additions & 4 deletions include/vstore/_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CORTO_META_OBJECT(class, mount);
CORTO_META_OBJECT(struct, mount_policy);
CORTO_META_OBJECT(struct, mount_subscription);
CORTO_META_OBJECT(class, loader);
CORTO_META_OBJECT(struct, result);
CORTO_META_OBJECT(struct, record);
CORTO_META_OBJECT(struct, request);
CORTO_META_OBJECT(struct, frame);
CORTO_META_OBJECT(struct, query);
Expand All @@ -38,12 +38,12 @@ CORTO_META_OBJECT(interface, dispatcher);
CORTO_META_OBJECT(enum, equalityKind);
CORTO_META_OBJECT(enum, operatorKind);
CORTO_META_OBJECT(bitmask, eventMask);
CORTO_META_OBJECT(bitmask, resultMask);
CORTO_META_OBJECT(bitmask, recordMask);
CORTO_META_OBJECT(enum, ownership);
CORTO_META_OBJECT(bitmask, mountCallbackMask);
CORTO_META_OBJECT(enum, frameKind);

CORTO_META_OBJECT(list, resultlist);
CORTO_META_OBJECT(list, recordlist);
CORTO_META_OBJECT(list, mount_subscriptionList);
CORTO_META_OBJECT(sequence, augmentseq);

Expand All @@ -65,7 +65,7 @@ CORTO_META_OBJECT(struct, subscriber_event);
CORTO_META_OBJECT(struct, invoke_event);
CORTO_META_OBJECT(struct, time);

CORTO_META_OBJECT(iterator, resultIter);
CORTO_META_OBJECT(iterator, recordIter);
CORTO_META_OBJECT(iterator, sampleIter);
CORTO_META_OBJECT(iterator, subscriber_eventIter);

Expand Down
24 changes: 12 additions & 12 deletions include/vstore/_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ typedef struct corto_mount_s {
double sample_rate;
uint32_t queue_max;
uint64_t expiry_time;
bool filter_results;
bool filter_records;
corto_mount_subscriptionList subscriptions;
corto_objectlist events;
corto_objectlist historicalEvents;
Expand Down Expand Up @@ -246,8 +246,8 @@ typedef struct corto_remote_s {
struct corto_method_s super;
} *corto_remote;

/* bitmask corto/vstore/resultMask */
typedef uint32_t corto_resultMask;
/* bitmask corto/vstore/recordMask */
typedef uint32_t corto_recordMask;
#define CORTO_RESULT_LEAF (0x1)
#define CORTO_RESULT_HIDDEN (0x2)

Expand All @@ -259,24 +259,24 @@ typedef struct corto_sample {

typedef corto_iter corto_sampleIter;

/* struct corto/vstore/result */
typedef struct corto_result {
/* struct corto/vstore/record */
typedef struct corto_record {
corto_string id;
corto_string name;
corto_string parent;
corto_string type;
uintptr_t value;
corto_resultMask flags;
corto_recordMask flags;
corto_object object;
corto_sampleIter history;
corto_object owner;
} corto_result;
} corto_record;

typedef corto_iter corto_resultIter;
typedef corto_iter corto_recordIter;

#ifndef corto_resultlist_DEFINED
#define corto_resultlist_DEFINED
typedef corto_ll corto_resultlist;
#ifndef corto_recordlist_DEFINED
#define corto_recordlist_DEFINED
typedef corto_ll corto_recordlist;
#endif

/* procedure corto/vstore/route */
Expand Down Expand Up @@ -311,7 +311,7 @@ typedef struct corto_subscriber_event {
corto_object instance;
corto_object source;
corto_eventMask event;
corto_result data;
corto_record data;
corto_fmt_data fmt;
} corto_subscriber_event;

Expand Down
8 changes: 4 additions & 4 deletions include/vstore/vstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ typedef struct corto_select__fluent {
struct corto_select__fluent (*yield_unknown)();

/** Return an iterator to the requested results.
* Results are returned as corto_result instances. A corto_result contains
* Results are returned as corto_record instances. A corto_record contains
* metadata and when a content type is specified, a serialized value of an
* object. When using this function, no objects are created.
*
* @param iter_out A pointer to an iterator object.
* @return 0 if success, -1 if failed.
*/
int16_t (*iter)(
corto_resultIter *iter_out);
corto_recordIter *iter_out);

/** Resume objects into the object store.
* This function will resume objects in the object store.
Expand Down Expand Up @@ -258,7 +258,7 @@ typedef struct corto_select__fluent {
struct corto_select__fluent (*vstore)(
bool enable); /* Unstable API */

int16_t (*subscribe)(corto_resultIter *ret); /* Unstable API */
int16_t (*subscribe)(corto_recordIter *ret); /* Unstable API */
int16_t (*unsubscribe)(void); /* Unstable API */
char* (*id)(void); /* Unstable API */
} corto_select__fluent;
Expand Down Expand Up @@ -386,7 +386,7 @@ typedef struct corto_subscribe__fluent {
* data events (`DEFINE`, `UPDATE`, `DELETE`).
*
* The difference between subscribers and observers is that while observers
* provide a reference to an object, a subscriber returns a `corto_result`, which
* provide a reference to an object, a subscriber returns a `corto_record`, which
* contains metadata about the object, and when requested, a serialized value.
*
* This means that a subscriber does not require objects to be stored in the
Expand Down
Loading

0 comments on commit 4468af6

Please sign in to comment.