Пример #1
0
        //This mimics what's done in Akka`s construction of an LocalActorRef.
        //The actorCell is created in the overridable newActorCell() during creation of the instance.
        //Since we don't want calls to virtual members in C# we must supply it.
        //
        //This is the code from Akka:
        //    private[akka] class LocalActorRef private[akka] (
        //        _system: ActorSystemImpl,
        //        _props: Props,
        //        _dispatcher: MessageDispatcher,
        //        _mailboxType: MailboxType,
        //        _supervisor: InternalActorRef,
        //        override val path: ActorPath) extends ActorRefWithCell with LocalRef {
        //      private val actorCell: ActorCell = newActorCell(_system, this, _props, _dispatcher, _supervisor)
        //      actorCell.init(sendSupervise = true, _mailboxType)
        //      ...
        //    }
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="system">TBD</param>
        /// <param name="props">TBD</param>
        /// <param name="dispatcher">TBD</param>
        /// <param name="mailboxType">TBD</param>
        /// <param name="supervisor">TBD</param>
        /// <param name="path">TBD</param>
        public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType,
                             IInternalActorRef supervisor, ActorPath path)
        {
            _system     = system;
            _props      = props;
            _dispatcher = dispatcher;
            MailboxType = mailboxType;
            _supervisor = supervisor;
            _path       = path;

            /*
             * Safe publication of this class’s fields is guaranteed by Mailbox.SetActor()
             * which is called indirectly from ActorCell.init() (if you’re wondering why
             * this is at all important, remember that under the CLR readonly fields are only
             * frozen at the _end_ of the constructor, but we are publishing "this" before
             * that is reached).
             * This means that the result of NewActorCell needs to be written to the field
             * _cell before we call init and start, since we can start using "this"
             * object from another thread as soon as we run init.
             */
            // ReSharper disable once VirtualMemberCallInConstructor
            _cell = NewActorCell(_system, this, _props, _dispatcher,
                                 _supervisor); // _cell needs to be assigned before Init is called.
            _cell.Init(true, MailboxType);
        }
Пример #2
0
        // Token: 0x06000FC2 RID: 4034 RVA: 0x0005D2C0 File Offset: 0x0005B4C0
        public MailboxStatistics(string mdbName, MailboxData mailboxData, ErrorStatistics errorStatistics, StoreStatistics storeStatistics)
        {
            this.DatabaseName    = mdbName;
            this.MailboxGuid     = mailboxData.MailboxGuid;
            this.ErrorStatistics = errorStatistics;
            this.StoreStatistics = storeStatistics;
            MailboxType mailboxType = MailboxType.Unknown;
            StoreMailboxDataExtended storeMailboxDataExtended = mailboxData as StoreMailboxDataExtended;

            if (storeMailboxDataExtended != null)
            {
                mailboxType = MailboxType.Default;
                if (storeMailboxDataExtended.IsPublicFolderMailbox)
                {
                    mailboxType |= MailboxType.PublicFolder;
                }
                if (storeMailboxDataExtended.IsArchiveMailbox)
                {
                    mailboxType |= MailboxType.Archive;
                }
                if (storeMailboxDataExtended.IsGroupMailbox)
                {
                    mailboxType |= MailboxType.ModernGroup;
                }
                if (storeMailboxDataExtended.IsSharedMailbox)
                {
                    mailboxType |= MailboxType.Shared;
                }
                if (storeMailboxDataExtended.IsTeamSiteMailbox)
                {
                    mailboxType |= MailboxType.TeamSite;
                }
            }
            this.Type = mailboxType;
        }
        private void RetrieveFailedItemsCount(ADRawEntry adRawEntry, MailboxType mailboxType)
        {
            base.PerformMailboxDiscovery(adRawEntry, mailboxType, out this.groupId, out this.mailboxInfo);
            switch (this.groupId.GroupType)
            {
            case GroupType.CrossServer:
            case GroupType.CrossPremise:
                base.ExecuteSearchWebService();
                return;

            case GroupType.SkippedError:
            {
                string error = (this.groupId.Error == null) ? string.Empty : this.groupId.Error.Message;
                base.AddFailedMailbox(this.mailboxInfo.LegacyExchangeDN, error);
                return;
            }

            default:
                if (this.mailboxInfo.MailboxGuid != Guid.Empty)
                {
                    Guid   guid            = (mailboxType == MailboxType.Archive) ? this.mailboxInfo.ArchiveDatabase : this.mailboxInfo.MdbGuid;
                    string indexSystemName = FastIndexVersion.GetIndexSystemName(guid);
                    using (IFailedItemStorage failedItemStorage = Factory.Current.CreateFailedItemStorage(Factory.Current.CreateSearchServiceConfig(), indexSystemName))
                    {
                        FailedItemParameters parameters = new FailedItemParameters(FailureMode.All, FieldSet.None)
                        {
                            MailboxGuid = new Guid?(this.mailboxInfo.MailboxGuid)
                        };
                        int totalNonIndexableItems = (int)failedItemStorage.GetFailedItemsCount(parameters);
                        this.UpdateResults(this.mailboxInfo.LegacyExchangeDN, totalNonIndexableItems);
                    }
                }
                return;
            }
        }
Пример #4
0
 /// <summary>
 /// Create a new mailbox for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPMailboxManager(IMAPAsyncClient client)
 {
     _boxType = MailboxType.Virtual;
     //_physMailboxLoaded = false;
     _client = client;
     _client.DataManager.New();
 }
        public MicrosoftOnlineWithMailboxTask(MailboxType type, Guid[] licenseGroups)
            : base("MicrosoftOnlineWithMailbox", "Microsoft 365 with mailbox")
        {
            if (licenseGroups == null || licenseGroups.Length == 0)
            {
                throw new ArgumentException(nameof(licenseGroups));
            }
            Type          = type;
            LicenseGroups = licenseGroups;
            List <AccountTask> tasks = new List <AccountTask> {
                new EnableRemoteMailboxTask(),
                new WaitTask(5),
                new ConfigureRemoteMailboxTask(),
                new MsolEnableSyncTask(),
                new MsolLicenseGroupTask(skipSyncCheck: true, skipDynamicGroupCheck: false),
                new WaitTask(120),
                new ConfigureOnlineMailboxTask(),
                new ConfigureOnlineOwaTask()
            };

            if (type == MailboxType.Employee || type == MailboxType.Faculty)
            {
                tasks.Add(new SendWelcomeMailTask());
            }
            SetTasks(tasks);
        }
Пример #6
0
        private void RetrieveFailedItems(ADRawEntry adRawEntry, MailboxType mailboxType)
        {
            base.PerformMailboxDiscovery(adRawEntry, mailboxType, out this.groupId, out this.mailboxInfo);
            switch (this.groupId.GroupType)
            {
            case GroupType.CrossServer:
            case GroupType.CrossPremise:
                base.ExecuteSearchWebService();
                return;

            case GroupType.SkippedError:
            {
                string error = (this.groupId.Error == null) ? string.Empty : this.groupId.Error.Message;
                base.AddFailedMailbox(this.mailboxInfo.LegacyExchangeDN, error);
                return;
            }

            default:
                if (this.mailboxInfo.MailboxGuid != Guid.Empty)
                {
                    Guid   guid            = (mailboxType == MailboxType.Archive) ? this.mailboxInfo.ArchiveDatabase : this.mailboxInfo.MdbGuid;
                    string indexSystemName = FastIndexVersion.GetIndexSystemName(guid);
                    using (IFailedItemStorage failedItemStorage = Factory.Current.CreateFailedItemStorage(Factory.Current.CreateSearchServiceConfig(), indexSystemName))
                    {
                        List <NonIndexableItem> nonIndexableItems = new List <NonIndexableItem>();
                        NonIndexableItemDetailsProvider.AddFailedItemsToCollection(failedItemStorage, this.mailboxInfo.MailboxGuid, this.GetReferenceDocId(), this.pagingInfo.PageSize, nonIndexableItems);
                        this.UpdateResults(nonIndexableItems);
                    }
                }
                return;
            }
        }
Пример #7
0
 /// <summary>
 /// Create a new mailbox for the specified client
 /// </summary>
 /// <param name="client"></param>
 public IMAPMailboxManager(IMAPAsyncClient client)
 {
     _boxType = MailboxType.Virtual;
     //_physMailboxLoaded = false;
     _client = client;
     _client.DataManager.New();
 }
Пример #8
0
 public void Setup(BenchmarkContext context)
 {
     _createMailboxThroughput = context.GetCounter(CreateThroughputCounter);
     _mailboxes                      = new List <Mailbox>(MailboxCreateNumber);
     _unboundedMailboxType           = new UnboundedMailbox();
     _boundedMailboxType             = new BoundedMailbox(_actorSystem.Settings, MailboxConfig);
     _unboundedDequeBasedMailboxType = new UnboundedDequeBasedMailbox(_actorSystem.Settings, MailboxConfig);
     _boundedDequeBasedMailboxType   = new BoundedDequeBasedMailbox(_actorSystem.Settings, MailboxConfig);
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailAddress"/> class.
 /// </summary>
 /// <param name="name">The name used to initialize the EmailAddress.</param>
 /// <param name="address">The address used to initialize the EmailAddress.</param>
 /// <param name="routingType">The routing type used to initialize the EmailAddress.</param>
 /// <param name="mailboxType">Mailbox type of the participant.</param>
 internal EmailAddress(
     string name,
     string address,
     string routingType,
     MailboxType mailboxType)
     : this(name, address, routingType)
 {
     this.mailboxType = mailboxType;
 }
Пример #10
0
 public RepointableActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType, IInternalActorRef supervisor, ActorPath path)
 {
     System = system;
     Props = props;
     Dispatcher = dispatcher;
     MailboxType = mailboxType;
     Supervisor = supervisor;
     _path = path;
 }
Пример #11
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="system">TBD</param>
 /// <param name="props">TBD</param>
 /// <param name="dispatcher">TBD</param>
 /// <param name="mailboxType">TBD</param>
 /// <param name="supervisor">TBD</param>
 /// <param name="path">TBD</param>
 public RepointableActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType, IInternalActorRef supervisor, ActorPath path)
 {
     System      = system;
     Props       = props;
     Dispatcher  = dispatcher;
     MailboxType = mailboxType;
     Supervisor  = supervisor;
     _path       = path;
 }
 public void Setup(BenchmarkContext context)
 {
     _createMailboxThroughput = context.GetCounter(CreateThroughputCounter);
     _mailboxes = new List<Mailbox>(MailboxCreateNumber);
     _unboundedMailboxType = new UnboundedMailbox();
     _boundedMailboxType = new BoundedMailbox(_actorSystem.Settings, MailboxConfig);
     _unboundedDequeBasedMailboxType = new UnboundedDequeBasedMailbox(_actorSystem.Settings, MailboxConfig);
     _boundedDequeBasedMailboxType = new BoundedDequeBasedMailbox(_actorSystem.Settings, MailboxConfig);
 }
Пример #13
0
        /// <summary>
        /// INTERNAL
        /// <remarks>Note! Part of internal API. Breaking changes may occur without notice. Use at own risk.</remarks>
        /// </summary>
        /// <param name="system">TBD</param>
        /// <param name="props">TBD</param>
        /// <param name="supervisor">TBD</param>
        /// <param name="name">TBD</param>
        /// <exception cref="IllegalStateException">TBD</exception>
        /// <returns>TBD</returns>
        public static InternalTestActorRef Create(ActorSystem system, Props props, IActorRef supervisor = null, string name = null)
        {
            if (name == null)
            {
                name = CreateUniqueName();
            }

            if (supervisor == null)
            {
                var systemImpl = (ActorSystemImpl)system;
                supervisor = systemImpl.Guardian;
            }


            if (props.Deploy.Dispatcher == Deploy.NoDispatcherGiven)
            {
                props = props.WithDispatcher(CallingThreadDispatcher.Id);
            }

            var dispatcher = system.Dispatchers.Lookup(props.Deploy.Dispatcher);

            var supervisorLocal = supervisor as LocalActorRef;

            if (supervisorLocal != null)
            {
                supervisorLocal.Cell.ReserveChild(name);
            }
            else
            {
                var supervisorRep = supervisor as RepointableActorRef;
                if (supervisorRep != null)
                {
                    var repUnderlying = supervisorRep.Underlying;
                    if (repUnderlying is UnstartedCell)
                    {
                        throw new IllegalStateException("Cannot attach a TestActor to an unstarted top-level actor, ensure that it is started by sending a message and observing the reply");
                    }
                    var cellUnderlying = repUnderlying as ActorCell;
                    if (cellUnderlying != null)
                    {
                        cellUnderlying.ReserveChild(name);
                    }
                    else
                    {
                        system.Log.Error("Trying to attach child {0} to unknown type of supervisor cell {1}, this is not going to end well", name, repUnderlying.GetType());
                    }
                }
            }

            MailboxType mailbox      = system.Mailboxes.GetMailboxType(props, dispatcher.Configurator.Config);
            var         testActorRef = new InternalTestActorRef((ActorSystemImpl)system, props, dispatcher, mailbox, (IInternalActorRef)supervisor, supervisor.Path / name);

            // we need to start ourselves since the creation of an actor has been split into initialization and starting
            testActorRef.Underlying.Start();
            return(testActorRef);
        }
 public MicrosoftOnlineRestoreTask(MailboxType type, List <AccountTask> tasks)
     : base("MicrosoftOnlineRestore", "Restore Microsoft 365 licenses and configure mailbox")
 {
     if (tasks == null || tasks.Count == 0)
     {
         throw new ArgumentException(nameof(tasks));
     }
     Type = type;
     SetTasks(tasks);
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailAddress"/> class.
 /// </summary>
 /// <param name="name">The name used to initialize the EmailAddress.</param>
 /// <param name="address">The address used to initialize the EmailAddress.</param>
 /// <param name="routingType">The routing type used to initialize the EmailAddress.</param>
 /// <param name="mailboxType">Mailbox type of the participant.</param>
 /// <param name="itemId">ItemId of a Contact or PDL.</param>
 internal EmailAddress(
     string name,
     string address,
     string routingType,
     MailboxType mailboxType,
     ItemId itemId)
     : this(name, address, routingType)
 {
     this.mailboxType = mailboxType;
     this.id          = itemId;
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoutedActorRef"/> class.
 /// </summary>
 /// <param name="system">TBD</param>
 /// <param name="routerProps">TBD</param>
 /// <param name="routerDispatcher">TBD</param>
 /// <param name="routerMailbox">TBD</param>
 /// <param name="routeeProps">TBD</param>
 /// <param name="supervisor">TBD</param>
 /// <param name="path">TBD</param>
 public RoutedActorRef(
     ActorSystemImpl system,
     Props routerProps,
     MessageDispatcher routerDispatcher,
     MailboxType routerMailbox,
     Props routeeProps,
     IInternalActorRef supervisor,
     ActorPath path)
     : base(system, routerProps, routerDispatcher, routerMailbox, supervisor, path)
 {
     _routeeProps = routeeProps;
     routerProps.RouterConfig.VerifyConfig(path);
 }
Пример #17
0
 public RoutedActorRef(
     ActorSystemImpl system,
     Props routerProps,
     MessageDispatcher routerDispatcher,
     MailboxType routerMailbox,
     Props routeeProps,
     IInternalActorRef supervisor,
     ActorPath path)
     : base(system, routerProps, routerDispatcher, routerMailbox, supervisor, path)
 {
     _routeeProps = routeeProps;
     routerProps.RouterConfig.VerifyConfig(path);
 }
        protected void PerformMailboxDiscovery(ADRawEntry adRawEntry, MailboxType mailboxType, out GroupId groupId, out MailboxInfo mailboxInfo)
        {
            List <MailboxInfo> list = new List <MailboxInfo>(1);

            list.Add(new MailboxInfo(adRawEntry, mailboxType));
            IEwsEndpointDiscovery ewsEndpointDiscovery = Factory.Current.GetEwsEndpointDiscovery(list, this.orgId, this.callerInfo);
            long num  = 0L;
            long num2 = 0L;
            Dictionary <GroupId, List <MailboxInfo> >   source       = ewsEndpointDiscovery.FindEwsEndpoints(out num, out num2);
            KeyValuePair <GroupId, List <MailboxInfo> > keyValuePair = source.First <KeyValuePair <GroupId, List <MailboxInfo> > >();

            groupId     = keyValuePair.Key;
            mailboxInfo = keyValuePair.Value[0];
        }
Пример #19
0
        /// <summary>
        /// Initialize this cell, i.e. set up mailboxes and supervision. The UID must be
        /// reasonably different from the previous UID of a possible actor with the same path,
        /// which can be achieved by using <see cref="ThreadLocalRandom"/>
        /// </summary>
        /// <param name="sendSupervise">TBD</param>
        /// <param name="mailboxType">TBD</param>
        public void Init(bool sendSupervise, MailboxType mailboxType)
        {
            /*
             * Create the mailbox and enqueue the Create() message to ensure that
             * this is processed before anything else.
             */
            var mailbox = Dispatcher.CreateMailbox(this, mailboxType);

            Create createMessage;

            /*
             * The mailboxType was calculated taking into account what the MailboxType
             * has promised to produce. If that was more than the default, then we need
             * to reverify here because the dispatcher may well have screwed it up.
             */
            // we need to delay the failure to the point of actor creation so we can handle
            // it properly in the normal way
            var actorClass = Props.Type;

            if (System.Mailboxes.ProducesMessageQueue(mailboxType.GetType()) && System.Mailboxes.HasRequiredType(actorClass))
            {
                var req = System.Mailboxes.GetRequiredType(actorClass);
                if (req.IsInstanceOfType(mailbox.MessageQueue))
                {
                    createMessage = new Create(null);                                             //success
                }
                else
                {
                    var gotType = mailbox.MessageQueue == null ? "null" : mailbox.MessageQueue.GetType().FullName;
                    createMessage = new Create(new ActorInitializationException(Self, $"Actor [{Self}] requires mailbox type [{req}] got [{gotType}]"));
                }
            }
            else
            {
                createMessage = new Create(null);
            }

            SwapMailbox(mailbox);
            Mailbox.SetActor(this);

            //// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
            var self = Self;

            mailbox.SystemEnqueue(self, createMessage);

            if (sendSupervise)
            {
                Parent.SendSystemMessage(new Supervise(self, async: false));
            }
        }
 public MicrosoftOnlineRestoreTask(MailboxType type)
     : base("MicrosoftOnlineRestore", "Restore Microsoft 365 licenses and configure mailbox")
 {
     Type = type;
     SetTasks(new List <AccountTask>
     {
         new MsolRestoreLicenseGroupTask(),
         new WaitTask(120),
         new RemoveFromOnpremGroupTask("U-exch-ndr-mailbox"),
         new SetOnlineMailboxTypeTask(ExchangeMailboxType.Regular),
         new SetHiddenFromAddressListTask(false),
         new ConfigureOnlineMailboxTask(),
         new ConfigureOnlineOwaTask()
     });
 }
 public MicrosoftOnlineWithMailboxTask(MailboxType type, Guid[] licenseGroups, List <AccountTask> tasks)
     : base("MicrosoftOnlineWithMailbox", "Microsoft 365 with mailbox")
 {
     if (licenseGroups == null || licenseGroups.Length == 0)
     {
         throw new ArgumentException(nameof(licenseGroups));
     }
     if (tasks == null || tasks.Count == 0)
     {
         throw new ArgumentException(nameof(tasks));
     }
     Type          = type;
     LicenseGroups = licenseGroups;
     SetTasks(tasks);
 }
Пример #22
0
 internal bool TryLoadMailboxInfo()
 {
     Recorder.Trace(4L, TraceType.InfoTrace, new object[]
     {
         "SearchSource.TryLoadMailboxInfo Source:",
         this.ReferenceId,
         "SourceType:",
         this.SourceType,
         "Location:",
         this.SourceLocation,
         "ExtendedAttributes:",
         this.ExtendedAttributes
     });
     try
     {
         if (this.MailboxInfo == null)
         {
             int index = 0;
             if (this.ExtendedAttributes.ContainsKey(this.GetMailboxInfoKey(index)))
             {
                 this.OriginalReferenceId = (string)SearchHelper.ConvertFromString(this.ExtendedAttributes[this.GetMailboxInfoKey(index++)], typeof(string));
                 this.FolderSpec          = (string)SearchHelper.ConvertFromString(this.ExtendedAttributes[this.GetMailboxInfoKey(index++)], typeof(string));
                 MailboxType type = SearchHelper.ConvertFromString <MailboxType>(this.ExtendedAttributes[this.GetMailboxInfoKey(index++)]);
                 Dictionary <PropertyDefinition, object> dictionary = new Dictionary <PropertyDefinition, object>();
                 for (int i = 0; i < MailboxInfo.PropertyDefinitionCollection.Length; i++)
                 {
                     dictionary[MailboxInfo.PropertyDefinitionCollection[i]] = SearchHelper.ConvertFromString(this.ExtendedAttributes[this.GetMailboxInfoKey(index++)], MailboxInfo.PropertyDefinitionCollection[i]);
                 }
                 this.MailboxInfo = new MailboxInfo(dictionary, type);
                 this.MailboxInfo.SourceMailbox = this;
                 this.MailboxInfo.Folder        = this.FolderSpec;
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         Recorder.Trace(4L, TraceType.WarningTrace, new object[]
         {
             "SearchSource.TryLoadMailboxInfo Failed Source:",
             this.ReferenceId,
             "Error:",
             ex
         });
     }
     return(false);
 }
Пример #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupMember"/> class.
        /// </summary>
        /// <param name="address">The address of the member.</param>
        /// <param name="routingType">The routing type of the address.</param>
        /// <param name="mailboxType">The mailbox type of the member.</param>
        public GroupMember(string address, string routingType, MailboxType mailboxType)
            : this()
        {
            switch (mailboxType)
            {
                case MailboxType.PublicGroup:
                case MailboxType.PublicFolder:
                case MailboxType.Mailbox:
                case MailboxType.Contact:
                case MailboxType.OneOff:
                    this.AddressInformation = new EmailAddress(null, address, routingType, mailboxType);
                    break;

                default:
                    throw new ServiceLocalException(Strings.InvalidMailboxType);
            }
        }
Пример #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupMember"/> class.
        /// </summary>
        /// <param name="address">The address of the member.</param>
        /// <param name="routingType">The routing type of the address.</param>
        /// <param name="mailboxType">The mailbox type of the member.</param>
        public GroupMember(string address, string routingType, MailboxType mailboxType)
            : this()
        {
            switch (mailboxType)
            {
            case MailboxType.PublicGroup:
            case MailboxType.PublicFolder:
            case MailboxType.Mailbox:
            case MailboxType.Contact:
            case MailboxType.OneOff:
                this.AddressInformation = new EmailAddress(null, address, routingType, mailboxType);
                break;

            default:
                throw new ServiceLocalException(Strings.InvalidMailboxType);
            }
        }
Пример #25
0
        public void Init(ActorSystemImpl system)
        {
            _system = system;
            //The following are the lazy val statements in Akka
            var defaultDispatcher = system.Dispatchers.DefaultGlobalDispatcher;

            _defaultMailbox = system.Mailboxes.Lookup(Mailboxes.DefaultMailboxId);
            _rootGuardian   = CreateRootGuardian(system);
            _tempContainer  = new VirtualPathContainer(system.Provider, _tempNode, _rootGuardian, _log);
            _rootGuardian.SetTempContainer(_tempContainer);
            _userGuardian   = CreateUserGuardian(_rootGuardian, "user");
            _systemGuardian = CreateSystemGuardian(_rootGuardian, "system", _userGuardian);
            //End of lazy val

            _rootGuardian.Start();
            // chain death watchers so that killing guardian stops the application
            _systemGuardian.SendSystemMessage(new Watch(_userGuardian, _systemGuardian));
            _rootGuardian.SendSystemMessage(new Watch(_systemGuardian, _rootGuardian));
            _eventStream.StartDefaultLoggers(_system);
        }
Пример #26
0
        //This mimics what's done in Akka`s construction of an LocalActorRef.
        //The actorCell is created in the overridable newActorCell() during creation of the instance.
        //Since we don't want calls to virtual members in C# we must supply it. 
        //
        //This is the code from Akka:
        //    private[akka] class LocalActorRef private[akka] (
        //        _system: ActorSystemImpl,
        //        _props: Props,
        //        _dispatcher: MessageDispatcher,
        //        _mailboxType: MailboxType,
        //        _supervisor: InternalActorRef,
        //        override val path: ActorPath) extends ActorRefWithCell with LocalRef {
        //      private val actorCell: ActorCell = newActorCell(_system, this, _props, _dispatcher, _supervisor)
        //      actorCell.init(sendSupervise = true, _mailboxType)
        //      ...
        //    }
        public LocalActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType, IInternalActorRef supervisor, ActorPath path) 
        {
            _system = system;
            _props = props;
            _dispatcher = dispatcher;
            MailboxType = mailboxType;
            _supervisor = supervisor;
            _path = path;

           /*
            * Safe publication of this class’s fields is guaranteed by Mailbox.SetActor()
            * which is called indirectly from ActorCell.init() (if you’re wondering why
            * this is at all important, remember that under the CLR readonly fields are only
            * frozen at the _end_ of the constructor, but we are publishing “this” before
            * that is reached).
            * This means that the result of NewActorCell needs to be written to the field
            * _cell before we call init and start, since we can start using "this"
            * object from another thread as soon as we run init.
            */
            // ReSharper disable once VirtualMemberCallInContructor 
            _cell = NewActorCell(_system, this, _props, _dispatcher, _supervisor); // _cell needs to be assigned before Init is called. 
            _cell.Init(true, MailboxType);
        }
Пример #27
0
        public void Init(ActorSystemImpl system)
        {
            _system = system;
            //The following are the lazy val statements in Akka
            var defaultDispatcher = system.Dispatchers.DefaultGlobalDispatcher;
            _defaultMailbox = system.Mailboxes.Lookup(Mailboxes.DefaultMailboxId);
            _rootGuardian = CreateRootGuardian(system);
            _tempContainer = new VirtualPathContainer(system.Provider, _tempNode, _rootGuardian, _log);
            _rootGuardian.SetTempContainer(_tempContainer);
            _userGuardian = CreateUserGuardian(_rootGuardian, "user");
            _systemGuardian = CreateSystemGuardian(_rootGuardian, "system", _userGuardian);
            //End of lazy val

            _rootGuardian.Start();
            // chain death watchers so that killing guardian stops the application
            _systemGuardian.SendSystemMessage(new Watch(_userGuardian, _systemGuardian));
            _rootGuardian.SendSystemMessage(new Watch(_systemGuardian, _rootGuardian));
            _eventStream.StartDefaultLoggers(_system);
        }
Пример #28
0
 void IMailbox.Config(IReservation reservation, Guid primaryMailboxGuid, Guid physicalMailboxGuid, TenantPartitionHint partitionHint, Guid mdbGuid, MailboxType mbxType, Guid?mailboxContainerGuid)
 {
     throw new NotImplementedException();
 }
Пример #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupMember"/> class.
 /// </summary>
 /// <param name="smtpAddress">The SMTP address of the member.</param>
 /// <param name="mailboxType">The mailbox type of the member.</param>
 public GroupMember(string smtpAddress, MailboxType mailboxType)
     : this(smtpAddress, EmailAddress.SmtpRoutingType, mailboxType)
 {
 }
Пример #30
0
 // Token: 0x06000579 RID: 1401 RVA: 0x0001B4B5 File Offset: 0x000196B5
 internal static bool Contains(this MailboxType mailboxFilter, MailboxType mailboxType)
 {
     return((mailboxFilter & mailboxType) != (MailboxType)0);
 }
 private Mailbox CreateMailbox(MailboxType mailboxType)
 {
     return new Mailbox(mailboxType.Create(ActorRefs.Nobody, _actorSystem));
 }
Пример #32
0
 public void CreateNewMailbox(string mbxFile)
 {
     _boxType = MailboxType.Physical;
     _mailboxFile = mbxFile;
     ZipStorer.Create(mbxFile, "InterIMAP Mail Storage File");
 }
Пример #33
0
 /// <summary>
 /// Loads the specified mbx file
 /// </summary>
 /// <param name="mbxFile"></param>
 public void LoadMailbox(string mbxFile)
 {
     _boxType = MailboxType.Physical;
     _client.DataManager.Db.ReadXml(mbxFile);
     //_physMailboxLoaded = true;
 }
Пример #34
0
        private Type GetProducedMessageQueueType(MailboxType mailboxType)
        {
            var queueType = mailboxType.GetType().GetInterfaces()
                .Where(i => i.IsGenericType)
                .Where(i => i.GetGenericTypeDefinition() == ProducesMessageQueueGenericType)
                .Select(i => i.GetGenericArguments().First())
                .FirstOrDefault();

            if(queueType == null)
                throw new ArgumentException(nameof(mailboxType), $"No IProducesMessageQueue<TQueue> supplied for {mailboxType}; illegal mailbox type definition.");
            return queueType;
        }
Пример #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupMember"/> class.
 /// </summary>
 /// <param name="smtpAddress">The SMTP address of the member.</param>
 /// <param name="mailboxType">The mailbox type of the member.</param>
 public GroupMember(string smtpAddress, MailboxType mailboxType)
     : this(smtpAddress, EmailAddress.SmtpRoutingType, mailboxType)
 {
 }
Пример #36
0
        /// <summary>
        /// Initialize this cell, i.e. set up mailboxes and supervision. The UID must be
        /// reasonably different from the previous UID of a possible actor with the same path,
        /// which can be achieved by using <see cref="ThreadLocalRandom"/>
        /// </summary>
        /// <param name="sendSupervise"></param>
        /// <param name="mailboxType"></param>
        public void Init(bool sendSupervise, MailboxType mailboxType)
        {
            /*
             * Create the mailbox and enqueue the Create() message to ensure that
             * this is processed before anything else.
             */
            var mailbox = Dispatcher.CreateMailbox(this, mailboxType);

            Create createMessage;
            /*
             * The mailboxType was calculated taking into account what the MailboxType
             * has promised to produce. If that was more than the default, then we need
             * to reverify here because the dispatcher may well have screwed it up.
             */
            // we need to delay the failure to the point of actor creation so we can handle
            // it properly in the normal way
            var actorClass = Props.Type;
            if (System.Mailboxes.ProducesMessageQueue(mailboxType.GetType()) && System.Mailboxes.HasRequiredType(actorClass))
            {
                var req = System.Mailboxes.GetRequiredType(actorClass);
                if (req.IsInstanceOfType(mailbox.MessageQueue)) createMessage = new Create(null); //success
                else
                {
                    var gotType = mailbox.MessageQueue == null ? "null" : mailbox.MessageQueue.GetType().FullName;
                    createMessage = new Create(new ActorInitializationException(Self,$"Actor [{Self}] requires mailbox type [{req}] got [{gotType}]"));
                }
            }
            else
            {
               createMessage = new Create(null);
            }

            SwapMailbox(mailbox);
            Mailbox.SetActor(this);

            //// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
            var self = Self;
            mailbox.SystemEnqueue(self, createMessage);

            if(sendSupervise)
            {
                Parent.SendSystemMessage(new Supervise(self, async: false));
            }
        }
Пример #37
0
 private InternalTestActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType, IInternalActorRef supervisor, ActorPath path)
     : base(system, props, dispatcher, mailboxType, supervisor, path)
 {
 }
Пример #38
0
 /// <summary>
 /// Creates and returns a <see cref="Mailbox"/> for the given actor.
 /// </summary>
 /// <param name="cell">Cell of the actor.</param>
 /// <param name="mailboxType">The mailbox configurator.</param>
 /// <returns>The configured <see cref="Mailbox"/> for this actor.</returns>
 internal Mailbox CreateMailbox(ActorCell cell, MailboxType mailboxType)
 {
     return new Mailbox(mailboxType.Create(cell.Self, cell.System));
 }
Пример #39
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="system">TBD</param>
 /// <param name="props">TBD</param>
 /// <param name="dispatcher">TBD</param>
 /// <param name="mailboxType">TBD</param>
 /// <param name="supervisor">TBD</param>
 /// <param name="path">TBD</param>
 /// <param name="deadLetters">TBD</param>
 /// <param name="extraNames">TBD</param>
 public RootGuardianActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType,
                             IInternalActorRef supervisor, ActorPath path, IInternalActorRef deadLetters, IReadOnlyDictionary <string, IInternalActorRef> extraNames)
     : base(system, props, dispatcher, mailboxType, supervisor, path)
 {
     _deadLetters = deadLetters;
     _extraNames  = extraNames;
 }
Пример #40
0
 private InternalTestActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, MailboxType mailboxType, IInternalActorRef supervisor, ActorPath path)
     : base(system, props, dispatcher, mailboxType, supervisor, path)
 {
 }
Пример #41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailAddress"/> class.
 /// </summary>
 /// <param name="name">The name used to initialize the EmailAddress.</param>
 /// <param name="address">The address used to initialize the EmailAddress.</param>
 /// <param name="routingType">The routing type used to initialize the EmailAddress.</param>
 /// <param name="mailboxType">Mailbox type of the participant.</param>
 /// <param name="itemId">ItemId of a Contact or PDL.</param>
 internal EmailAddress(
     string name,
     string address,
     string routingType,
     MailboxType mailboxType,
     ItemId itemId)
     : this(name, address, routingType)
 {
     this.mailboxType = mailboxType;
     this.id = itemId;
 }
Пример #42
0
 /// <summary>
 /// Creates a new mailbox based on what is currently loaded.
 /// Can be used to create a backup of an existing physical mailbox, or
 /// create a new physical mailbox based on a virtual one.
 /// </summary>
 /// <param name="mbxFile"></param>
 public void SaveNewMailbox(string mbxFile)
 {
     _boxType = MailboxType.Physical;
     _client.DataManager.Db.WriteXml(mbxFile);
 }
Пример #43
0
 public void CreateNewMailbox(string mbxFile)
 {
     _boxType     = MailboxType.Physical;
     _mailboxFile = mbxFile;
     ZipStorer.Create(mbxFile, "InterIMAP Mail Storage File");
 }
Пример #44
0
 /// <summary>
 /// Creates an empty mailbox
 /// </summary>
 public void InitializeMailbox()
 {
     _boxType = MailboxType.Virtual;
 }
Пример #45
0
 /// <summary>
 /// Creates an empty mailbox
 /// </summary>
 public void InitializeMailbox()
 {
     _boxType = MailboxType.Virtual;
 }
Пример #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailAddress"/> class.
 /// </summary>
 /// <param name="name">The name used to initialize the EmailAddress.</param>
 /// <param name="address">The address used to initialize the EmailAddress.</param>
 /// <param name="routingType">The routing type used to initialize the EmailAddress.</param>
 /// <param name="mailboxType">Mailbox type of the participant.</param>
 internal EmailAddress(
     string name,
     string address,
     string routingType,
     MailboxType mailboxType)
     : this(name, address, routingType)
 {
     this.mailboxType = mailboxType;
 }
Пример #47
0
 /// <summary>
 /// Loads the specified mbx file
 /// </summary>
 /// <param name="mbxFile"></param>
 public void LoadMailbox(string mbxFile)
 {
     _boxType = MailboxType.Physical;
     _client.DataManager.Db.ReadXml(mbxFile);
     //_physMailboxLoaded = true;
 }
Пример #48
0
 void IMailbox.Config(IReservation reservation, Guid primaryMailboxGuid, Guid physicalMailboxGuid, TenantPartitionHint partitionHint, Guid mdbGuid, MailboxType mbxType, Guid?mailboxContainerGuid)
 {
     base.CheckDisposed();
     MrsTracer.Provider.Function("EasMailbox.IMailbox.Config", new object[0]);
 }
Пример #49
0
 /// <summary>
 /// Creates a new mailbox based on what is currently loaded.
 /// Can be used to create a backup of an existing physical mailbox, or
 /// create a new physical mailbox based on a virtual one.
 /// </summary>
 /// <param name="mbxFile"></param>
 public void SaveNewMailbox(string mbxFile)
 {
     _boxType = MailboxType.Physical;
     _client.DataManager.Db.WriteXml(mbxFile);
 }