コード例 #1
0
 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)));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
ファイル: MarshalHelper.cs プロジェクト: bcrusu/mesos-clr
        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;
        }
コード例 #4
0
ファイル: MarshalHelper.cs プロジェクト: bcrusu/mesos-clr
        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 });
        }
コード例 #5
0
ファイル: MarshalHelper.cs プロジェクト: bcrusu/mesos-clr
        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 });
        }
コード例 #6
0
 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)));
 }
コード例 #7
0
 private static void OfferRescinded(long managedDriverId, NativeArray* offerId)
 {
     CallScheduler(managedDriverId,
         (driver, executor) => executor.OfferRescinded(driver,
             ProtoBufHelper.Deserialize<OfferID>(offerId)));
 }
コード例 #8
0
 private static void StatusUpdate(long managedDriverId, NativeArray* status)
 {
     CallScheduler(managedDriverId,
         (driver, executor) => executor.StatusUpdate(driver,
             ProtoBufHelper.Deserialize<TaskStatus>(status)));
 }
コード例 #9
0
 private static void SlaveLost(long managedDriverId, NativeArray* slaveId)
 {
     CallScheduler(managedDriverId,
         (driver, executor) => executor.SlaveLost(driver,
             ProtoBufHelper.Deserialize<SlaveID>(slaveId)));
 }
コード例 #10
0
 private static void ResourceOffers(long managedDriverId, NativeArray* offers)
 {
     CallScheduler(managedDriverId,
         (driver, executor) => executor.ResourceOffers(driver,
             ProtoBufHelper.DeserializeCollection<Offer>(offers)));
 }
コード例 #11
0
ファイル: ExecutorCallbacks.cs プロジェクト: bcrusu/mesos-clr
 private static void Reregistered(long managedDriverId, NativeArray* slaveInfo)
 {
     CallExecutor(managedDriverId,
         (driver, executor) => executor.Reregistered(driver,
             ProtoBufHelper.Deserialize<SlaveInfo>(slaveInfo)));
 }
コード例 #12
0
ファイル: ExecutorCallbacks.cs プロジェクト: bcrusu/mesos-clr
 private static void LaunchTask(long managedDriverId, NativeArray* taskInfo)
 {
     CallExecutor(managedDriverId,
         (driver, executor) => executor.LaunchTask(driver,
             ProtoBufHelper.Deserialize<TaskInfo>(taskInfo)));
 }
コード例 #13
0
ファイル: ExecutorCallbacks.cs プロジェクト: bcrusu/mesos-clr
 private static void KillTask(long managedDriverId, NativeArray* taskId)
 {
     CallExecutor(managedDriverId,
         (driver, executor) => executor.KillTask(driver,
             ProtoBufHelper.Deserialize<TaskID>(taskId)));
 }
コード例 #14
0
ファイル: ExecutorCallbacks.cs プロジェクト: bcrusu/mesos-clr
 private static void FrameworkMessage(long managedDriverId, NativeArray* data)
 {
     CallExecutor(managedDriverId,
         (driver, executor) => executor.FrameworkMessage(driver,
             MarshalHelper.ToMangedByteArray(data)));
 }