Ticket #1082 (closed task: fixed)

Opened 3 years ago

Last modified 3 years ago

[API] hashtable should be created without filesystem interface access

Reported by: dgollub Owned by: dgollub
Priority: highest Milestone: OpenSync 0.39
Component: OpenSync: Plugin API Version: 0.38
Severity: blocker Keywords:
Cc:

Description

The current hashtable API requires/allows to specify a custom path. This makes updates and mainteancne a nightmare. Also moving to different database backends make this problematically for future releases.

We need to break the API before 0.39. Like the API change of the OSyncAnchor, we need to implement a "request" hashtable function which places the hashtable to a fixed location (this location is set internally in the engine $configdir/$member/hashtable.db).

-OSYNC_EXPORT OSyncHashTable *osync_hashtable_new(const char *path, const char *objtype, OSyncError **error);

Change History

comment:1 Changed 3 years ago by dgollub

  • Status changed from new to assigned

comment:2 Changed 3 years ago by dgollub

(In [5369]) Prepare new hashtable interface to request a OSyncHashTable. Similar to the OSyncAnchor request implementation.

refs #1082

comment:3 Changed 3 years ago by dgollub

(In [5371]) Dropped following interfaces: osync_hashtable_new osync_hashtable_ref osync_hashtable_unref osync_hashtable_load osync_hashtable_save

This affects all plugins using hashtables!

Short Porting instruction:

  • Drop osync_hashtable_{un,}ref() calls (no replacement required)
  • Drop osync_hashtable_new() (no replacement required)
  • Drop calls like osync_plugin_info_get_configdir() if they were used to create a hashtable path (obsolete now)
  • Drop calls of osync_hashtable_save() (no replacement required)
  • Call osync_objtype_sink_enable_hashtable(OSyncObjTypeSink *sink, TRUE); in plugin init function for each ObjTypeSink?
  • Hashtable will be initilaized and loaded by the Engine right after the plugin init function. Don't expect to get a HashTable? pointer in the init function!
  • You can get an valid OSyncHashTable pointer by calling inside Plugin Sink Functions (e.g. connect, get_changes, commit, sync_done, ...):

OSyncHashTable *hashtable = osync_objtype_sink_get_hashtable(sink);

  • Hashtable get stored after the sync_done() plugin call. No call by plugin required.

refs #1082 refs #1083

comment:4 Changed 3 years ago by dgollub

(In [5372]) Ported mock-sync plugin to latest Hashtable API change r5371

refs #1082

comment:5 Changed 3 years ago by dgollub

(In [5373]) Introduced osync_objtype_sink_save_hashtable() for osyncplugin tool. Temporarily disabled hashtable dumping inf osyncdump.

refs #1082

comment:6 Changed 3 years ago by dgollub

(In [5374]) Port example plugins to latest hashtable API change. Dropped obbsolate sinkenv userdata structs. Just kept pluginenv struct as example.

refs #1082

comment:7 Changed 3 years ago by dgollub

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [5375]) Ported file-sync plugin to latest hasthable API change (#1082).

fixes #1082

comment:8 Changed 3 years ago by Graham Cobb

In [5643], ported gpe-sync plugin to latest hashtable API change

Note: See TracTickets for help on using tickets.