示例#1
0
        public void Initialize(long managedDriverId, FrameworkInfo frameworkInfo, string masterAddress, bool implicitAcknowledgements, Credential credential)
        {
            var schedulerInterface = SchedulerCallbacks.GetSchedulerInterface();

            var frameworkInfoBytes = ProtoBufHelper.Serialize(frameworkInfo);

            byte[] credentialBytes = null;
            if (credential != null)
            {
                credentialBytes = ProtoBufHelper.Serialize(credential);
            }

            unsafe
            {
                using (var pinnedFrameworkInfo = MarshalHelper.CreatePinnedObject(frameworkInfoBytes))
                    using (var pinnedCredential = MarshalHelper.CreatePinnedObject(credentialBytes))
                        _nativeDriverPtr = NativeImports.SchedulerDriver.Initialize(managedDriverId, &schedulerInterface,
                                                                                    pinnedFrameworkInfo.Ptr, masterAddress, implicitAcknowledgements, pinnedCredential.Ptr);
            }
        }
示例#2
0
 public Status SendFrameworkMessage(byte[] data)
 {
     using (var pinned = MarshalHelper.CreatePinnedObject(data))
         return((Status)NativeImports.ExecutorDriver.SendFrameworkMessage(_nativeDriverPtr, pinned.Ptr));
 }
示例#3
0
 private static void FrameworkMessage(long managedDriverId, NativeArray *data)
 {
     CallExecutor(managedDriverId,
                  (driver, executor) => executor.FrameworkMessage(driver,
                                                                  MarshalHelper.ToMangedByteArray(data)));
 }