public void Subscribe(EventCallback callback) { NativeImports.TIO_DATA start = new NativeImports.TIO_DATA();// = NativeImports.TioDataConverter.FromObject(null); NativeImports.tio_container_subscribe( _nativeContainerHandle, ref start, delegate(int result, IntPtr cookie, IntPtr handle, uint eventCode, ref NativeImports.TIO_DATA key, ref NativeImports.TIO_DATA value, ref NativeImports.TIO_DATA metadata) { EventCode convertedEventCode = (EventCode)eventCode; callback( convertedEventCode, NativeImports.TioDataConverter.ToObject(key), NativeImports.TioDataConverter.ToObject(value), NativeImports.TioDataConverter.ToObject(metadata)); }, IntPtr.Zero); }
public void Disconnect() { NativeImports.tio_disconnect(_nativeHandle); _nativeHandle = new IntPtr(); _host = null; _port = 0; }
public Connection(string host, short port) { int result = NativeImports.tio_connect(host, port, out _nativeHandle); NativeImports.ThrowOnNativeApiError(result); _host = host; _port = port; }
public Container Open(string name) { IntPtr handle = new IntPtr(); int result = NativeImports.tio_open(_nativeHandle, name, "", out handle); NativeImports.ThrowOnNativeApiError(result); return(new Container(handle, name)); }
void Free() { if (_tiodata.data_type == TIO_DATA_TYPE_STRING) { NativeImports.tiodata_set_as_none(ref _tiodata); } else { _tiodata.data_type = TIO_DATA_TYPE_NONE; } }
public string GetProperty(string key) { int result; using (NativeImports.TioDataConverter k = NativeImports.TioDataConverter.FromObject(key), v = new NativeImports.TioDataConverter()) { result = NativeImports.tio_container_propget( _nativeContainerHandle, ref k._tiodata, out v._tiodata); NativeImports.ThrowOnNativeApiError(result); return(v.ToString()); } }
public void Set(object key, object value, object metadata = null) { using (NativeImports.TioDataConverter k = NativeImports.TioDataConverter.FromObject(key), v = NativeImports.TioDataConverter.FromObject(value), m = NativeImports.TioDataConverter.FromObject(metadata)) { int result; result = NativeImports.tio_container_set( _nativeContainerHandle, ref k._tiodata, ref v._tiodata, ref m._tiodata); NativeImports.ThrowOnNativeApiError(result); } }
public object Get(object searchKey) { object ret; using (NativeImports.TioDataConverter sk = NativeImports.TioDataConverter.FromObject(searchKey), k = new NativeImports.TioDataConverter(), v = new NativeImports.TioDataConverter(), m = new NativeImports.TioDataConverter()) { int result; result = NativeImports.tio_container_get( _nativeContainerHandle, ref sk._tiodata, out k._tiodata, out v._tiodata, out m._tiodata); ret = v.AsObject(); } return(ret); }
public void Query(QueryCallback callback) { NativeImports.tio_container_query( _nativeContainerHandle, 0, 0, null, delegate(int result, IntPtr handle, IntPtr cookie, uint queryid, string containerName, ref NativeImports.TIO_DATA key, ref NativeImports.TIO_DATA value, ref NativeImports.TIO_DATA metadata) { callback( NativeImports.TioDataConverter.ToObject(key), NativeImports.TioDataConverter.ToObject(value), NativeImports.TioDataConverter.ToObject(metadata)); }, IntPtr.Zero); }
public void Ping(string host, short port) { int result = NativeImports.tio_ping(_nativeHandle, "tioclient"); NativeImports.ThrowOnNativeApiError(result); }
public void Close() { int result = NativeImports.tio_disconnect(_nativeHandle); }
static Connection() { NativeImports.tio_initialize(); }