Ejemplo n.º 1
0
        private async Task <Tuple <IDatabaseInteractor, DatabaseInteractionStatus> > CreateDatabaseInteractor(DockerContainerConfigElement containerConfig, CancellationToken cancellationToken)
        {
            var containerWithName = DockerInstanceViewModels
                                    .SelectMany(i => i.DockerContainerViewModels)
                                    .Where(c => c.ContainerName == containerConfig.Name)
                                    .ToList();

            if (containerWithName.All(c => c.ContainerState != DockerContainerState.Started))
            {
                SendSnackbarMessage(new SnackbarMessage($"Inserting cannot be started since no container with name '{containerConfig.Name}' is started.", "DISMISS"));
                return(Tuple.Create <IDatabaseInteractor, DatabaseInteractionStatus>(null, DatabaseInteractionStatus.Incomplete));
            }

            var host = containerWithName.First(c => c.ContainerState == DockerContainerState.Started).Host;
            IDatabaseInteractor databaseInteractor = DatabaseInteractorFactory.CreateDatabaseInteractor(
                containerConfig.Name,
                host,
                _dockerConfigSection);

            if (databaseInteractor == null)
            {
                SendSnackbarMessage(new SnackbarMessage($"No Twitter loader available for container '{containerConfig.Name}'.", "DISMISS"));
                return(Tuple.Create <IDatabaseInteractor, DatabaseInteractionStatus>(null, DatabaseInteractionStatus.Incomplete));
            }

            await databaseInteractor.EnsureTableExistsAsync();

            if (cancellationToken.IsCancellationRequested)
            {
                return(Tuple.Create <IDatabaseInteractor, DatabaseInteractionStatus>(null, DatabaseInteractionStatus.Cancelled));
            }

            return(Tuple.Create(databaseInteractor, DatabaseInteractionStatus.Success));
        }
Ejemplo n.º 2
0
 public CollabManager(
     IHubContext <ProjectsGlobalHub> hubContext,
     IDatabaseInteractor dbInteractor,
     IFilesystemService filesystem)
 {
     this.hubContext   = hubContext;
     this.dbInteractor = dbInteractor;
     this.filesystem   = filesystem;
 }
Ejemplo n.º 3
0
 public LoginModel(IDatabaseInteractor dbInteractor)
 {
     DbInteractor = dbInteractor;
 }
Ejemplo n.º 4
0
 public RegisterPageModel(IDatabaseInteractor dbInteractor)
 {
     DbInteractor = dbInteractor;
 }
Ejemplo n.º 5
0
 public Filesystem(IDatabaseInteractor dbInteractor)
 {
     this.dbInteractor = dbInteractor;
 }