Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Update ouisync
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Sep 6, 2023
1 parent 37774e3 commit 174fd1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 67 deletions.
71 changes: 7 additions & 64 deletions lib/bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,6 @@ class Bindings {
late final _session_destroy =
_session_destroyPtr.asFunction<void Function(int)>();

/// Mount all repositories that are or will be opened in read and/or write mode.
///
/// # Safety
///
/// `session` must be a valid session handle.
void session_mount_all(
int session,
ffi.Pointer<ffi.Char> mount_point,
int port,
) {
return _session_mount_all(
session,
mount_point,
port,
);
}

late final _session_mount_allPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(SessionHandle, ffi.Pointer<ffi.Char>,
Port_Result_MountError)>>('session_mount_all');
late final _session_mount_all = _session_mount_allPtr
.asFunction<void Function(int, ffi.Pointer<ffi.Char>, int)>();

/// # Safety
///
/// `session` must be a valid session handle, `sender` must be a valid client sender handle,
Expand Down Expand Up @@ -169,7 +145,7 @@ class Bindings {
late final _file_copy_to_raw_fdPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(SessionHandle, Handle_FileHolder, ffi.Int,
Port_Result)>>('file_copy_to_raw_fd');
Port_Result_Error)>>('file_copy_to_raw_fd');
late final _file_copy_to_raw_fd =
_file_copy_to_raw_fdPtr.asFunction<void Function(int, int, int, int)>();

Expand Down Expand Up @@ -251,47 +227,17 @@ abstract class ErrorCode {
/// Argument passed to a function is not valid
static const int invalidArgument = 11;

/// Interface request is malformed
static const int malformedRequest = 12;
/// Request or response is malformed
static const int malformedMessage = 12;

/// Storage format version mismatch
static const int storageVersionMismatch = 13;

/// Connection lost
static const int connectionLost = 14;

/// Request is forbidden
static const int forbiddenRequest = 15;

/// Failed to parse the mount point string
static const int vfsFailedToParseMountPoint = 2048;

/// Mounting is not yes supported on this Operating System
static const int vfsUnsupportedOs = 2049;

/// A general error
static const int vfsGeneral = 2051;

/// Bad drive letter
static const int vfsDriveLetter = 2052;

/// Can't install the Dokan driver.
static const int vfsDriverInstall = 2053;

/// The driver responds that something is wrong.
static const int vfsStart = 2050;

/// Can't assign a drive letter or mount point.
///
/// This probably means that the mount point is already used by another volume.
static const int vfsMount = 2054;

/// The mount point is invalid.
static const int vfsMountPoint = 2055;

/// The Dokan version that this wrapper is targeting is incompatible with the loaded Dokan
/// library.
static const int vfsVersion = 2056;
static const int vfsInvalidMountPoint = 2048;
static const int vfsDriverInstall = 2049;
static const int vfsBackend = 2050;

/// Unspecified error
static const int other = 65535;
Expand All @@ -316,13 +262,10 @@ typedef ErrorCode1 = ffi.Uint16;
/// Type-safe wrapper over native dart SendPort.
typedef Port_Bytes = RawPort;
typedef RawPort = ffi.Int64;

/// Type-safe wrapper over native dart SendPort.
typedef Port_Result_MountError = RawPort;
typedef Handle_FileHolder = ffi.Uint64;

/// Type-safe wrapper over native dart SendPort.
typedef Port_Result = RawPort;
typedef Port_Result_Error = RawPort;

const int LOG_LEVEL_ERROR = 1;

Expand Down
3 changes: 1 addition & 2 deletions lib/ouisync_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class Session {
// read/write mode into the `mountPoint`. The `mountPoint` may point to an
// empty directory or may be a drive letter.
Future<void> mountAllRepositories(String mountPoint) async {
await _invoke<void>((port) => _withPoolSync((pool) => b.bindings
.session_mount_all(handle, pool.toNativeUtf8(mountPoint), port)));
await client.invoke<void>("repository_mount_all", mountPoint);
_mountPoint = mountPoint;
}

Expand Down
2 changes: 1 addition & 1 deletion ouisync
Submodule ouisync updated 115 files

0 comments on commit 174fd1c

Please sign in to comment.