private static void FrameworkMessage(long managedDriverId, NativeArray* executorId, NativeArray* slaveId, NativeArray* data) { CallScheduler(managedDriverId, (driver, executor) => executor.FrameworkMessage(driver, ProtoBufHelper.Deserialize<ExecutorID>(executorId), ProtoBufHelper.Deserialize<SlaveID>(slaveId), MarshalHelper.ToMangedByteArray(data))); }
private static void ExecutorLost(long managedDriverId, NativeArray* executorId, NativeArray* slaveId, int status) { CallScheduler(managedDriverId, (driver, executor) => executor.ExecutorLost(driver, ProtoBufHelper.Deserialize<ExecutorID>(executorId), ProtoBufHelper.Deserialize<SlaveID>(slaveId), status)); }
public static unsafe byte[] ToMangedByteArray(NativeArray* bytes) { var length = (*bytes).Length; var data = (*bytes).Items; var result = new byte[length]; Marshal.Copy(data, result, 0, length); return result; }
public static PinnedObject CreatePinnedObject(byte[] bytes) { if (bytes == null) return PinnedObject.Null; var bytesPinned = new PinnedObject(bytes); var byteArray = new NativeArray { Length = bytes.Length, Items = bytesPinned.Ptr }; return new PinnedObject(byteArray, new[] { bytesPinned }); }
public static PinnedObject CreatePinnedObject(IEnumerable<byte[]> arrays) { if (arrays == null) return PinnedObject.Null; var pinnedArrays = arrays.Select(CreatePinnedObject).ToList(); var arrayPtrs = pinnedArrays.Select(x => x.Ptr).ToArray(); var pinnedArrayPtrs = new PinnedObject(arrayPtrs, pinnedArrays); var array = new NativeArray { Length = pinnedArrays.Count, Items = pinnedArrayPtrs.Ptr }; return new PinnedObject(array, new[] { pinnedArrayPtrs }); }
private static void Registered(long managedDriverId, NativeArray* frameworkId, NativeArray* masterInfo) { CallScheduler(managedDriverId, (driver, executor) => executor.Registered(driver, ProtoBufHelper.Deserialize<FrameworkID>(frameworkId), ProtoBufHelper.Deserialize<MasterInfo>(masterInfo))); }
private static void OfferRescinded(long managedDriverId, NativeArray* offerId) { CallScheduler(managedDriverId, (driver, executor) => executor.OfferRescinded(driver, ProtoBufHelper.Deserialize<OfferID>(offerId))); }
private static void StatusUpdate(long managedDriverId, NativeArray* status) { CallScheduler(managedDriverId, (driver, executor) => executor.StatusUpdate(driver, ProtoBufHelper.Deserialize<TaskStatus>(status))); }
private static void SlaveLost(long managedDriverId, NativeArray* slaveId) { CallScheduler(managedDriverId, (driver, executor) => executor.SlaveLost(driver, ProtoBufHelper.Deserialize<SlaveID>(slaveId))); }
private static void ResourceOffers(long managedDriverId, NativeArray* offers) { CallScheduler(managedDriverId, (driver, executor) => executor.ResourceOffers(driver, ProtoBufHelper.DeserializeCollection<Offer>(offers))); }
private static void Reregistered(long managedDriverId, NativeArray* slaveInfo) { CallExecutor(managedDriverId, (driver, executor) => executor.Reregistered(driver, ProtoBufHelper.Deserialize<SlaveInfo>(slaveInfo))); }
private static void LaunchTask(long managedDriverId, NativeArray* taskInfo) { CallExecutor(managedDriverId, (driver, executor) => executor.LaunchTask(driver, ProtoBufHelper.Deserialize<TaskInfo>(taskInfo))); }
private static void KillTask(long managedDriverId, NativeArray* taskId) { CallExecutor(managedDriverId, (driver, executor) => executor.KillTask(driver, ProtoBufHelper.Deserialize<TaskID>(taskId))); }
private static void FrameworkMessage(long managedDriverId, NativeArray* data) { CallExecutor(managedDriverId, (driver, executor) => executor.FrameworkMessage(driver, MarshalHelper.ToMangedByteArray(data))); }