//Use THIS static method to create a job...
		public static SyncMetadataJob Create (JobStore job_store, Photo photo)
		{
			return (SyncMetadataJob) job_store.CreatePersistent (typeof (FSpot.Jobs.SyncMetadataJob), photo.Id.ToString ());
		}
Esempio n. 2
0
 public static CalculateHashJob Create(JobStore job_store, uint photo_id)
 {
     return (CalculateHashJob) job_store.CreatePersistent (typeof(FSpot.Jobs.CalculateHashJob), photo_id.ToString ());
 }
Esempio n. 3
0
File: Db.cs Progetto: GNOME/f-spot
        public void Init(string path, bool create_if_missing)
        {
            uint timer = Log.DebugTimerStart ();
            bool new_db = !File.Exists (path);
            this.path = path;

            if (new_db && !create_if_missing)
                throw new Exception (path + ": File not found");

            Database = new FSpotDatabaseConnection (path);

            // Load or create the meta table
            Meta = new MetaStore (Database, new_db);

            // Update the database schema if necessary
            FSpot.Database.Updater.Run (Database);

            Database.BeginTransaction ();

            Tags = new TagStore (Database, new_db);
            Rolls = new RollStore (Database, new_db);
            Exports = new ExportStore (Database, new_db);
            Jobs = new JobStore (Database, new_db);
            Photos = new PhotoStore (Database, new_db);

            Database.CommitTransaction ();

            Empty = new_db;
            Log.DebugTimerPrint (timer, "Db Initialization took {0}");
        }
Esempio n. 4
0
 internal void ResetMocks()
 {
     Jobs.Reset();
     JobStore.Reset();
 }
 public void ClearAllJobStoreData()
 {
     System.Diagnostics.Debug.Write("here");
     JobStore?.ClearAllSchedulingData();
     System.Diagnostics.Debug.Write(counter++);
 }
Esempio n. 6
0
 //Use THIS static method to create a job...
 public static SyncMetadataJob Create(JobStore job_store, Photo photo)
 {
     return((SyncMetadataJob)job_store.CreatePersistent(JobName, photo.Id.ToString()));
 }
 public CreateSqLiteDatabase(ILogger <CreateSqLiteDatabase> logger, QuartzSqliteOptions options, JobStore settings)
 {
     _options              = options;
     _settings             = settings;
     _logger               = logger ?? new NullLogger <CreateSqLiteDatabase>();
     _propertiesCollection = _options.GetDatabaseProperties(settings);
 }
Esempio n. 8
0
	public void Init (string path, bool create_if_missing)
	{
		bool new_db = ! File.Exists (path);
		this.path = path;

		if (new_db && ! create_if_missing)
			throw new Exception (path + ": File not found");

		database = new QueuedSqliteDatabase(path);	

		// Load or create the meta table
 		meta_store = new MetaStore (Database, new_db);

		// Update the database schema if necessary
		FSpot.Database.Updater.Run (this);

		Database.BeginTransaction ();
		
		face_store = new FaceStore (Database, new_db);
		tag_store = new TagStore (Database, new_db);
		roll_store = new RollStore (Database, new_db);
		export_store = new ExportStore (Database, new_db);
		job_store = new JobStore (Database, new_db);
 		photo_store = new PhotoStore (Database, new_db);
		
		Database.CommitTransaction ();

		empty = new_db;
	}
Esempio n. 9
0
 public static CalculateHashJob Create(JobStore job_store, uint photo_id)
 {
     return((CalculateHashJob)job_store.CreatePersistent(JobName, photo_id.ToString()));
 }
Esempio n. 10
0
 //Use THIS static method to create a job...
 public static SyncMetadataJob Create(JobStore job_store, Photo photo)
 {
     return((SyncMetadataJob)job_store.CreatePersistent(typeof(FSpot.Jobs.SyncMetadataJob), photo.Id.ToString()));
 }
Esempio n. 11
0
	public void Init (string path, bool create_if_missing)
	{
		uint timer = Log.DebugTimerStart ();
		bool new_db = ! File.Exists (path);
		this.path = path;

		if (new_db && ! create_if_missing)
			throw new Exception (path + ": File not found");

		database = new QueuedSqliteDatabase(path);
		database.ExceptionThrown += HandleDbException;

		if (database.GetFileVersion(path) == 2)
			SqliteUpgrade ();

		// Load or create the meta table
 		meta_store = new MetaStore (Database, new_db);

		// Update the database schema if necessary
		FSpot.Database.Updater.Run (this);

		Database.BeginTransaction ();

		tag_store = new TagStore (Database, new_db);
		roll_store = new RollStore (Database, new_db);
		export_store = new ExportStore (Database, new_db);
		job_store = new JobStore (Database, new_db);
 		photo_store = new PhotoStore (Database, new_db);

		Database.CommitTransaction ();

		empty = new_db;
		Log.DebugTimerPrint (timer, "Db Initialization took {0}");
	}
Esempio n. 12
0
        public async Task <long> GetQueueLength(string tenantId, string jobId)
        {
            var jobQueue = GetJobQueue((await JobStore.Load(tenantId, jobId)));

            return(jobQueue == null ? 0 : await jobQueue.GetQueueLength(jobId));
        }
Esempio n. 13
0
 public async Task AddPredecessor(string tenantId, string jobId, string predecessorJobId)
 {
     await JobStore.AddPredecessor(tenantId, jobId, predecessorJobId);
 }
        //public static Task Run(
        //    string[] args, Action<ClientCofiguration> clientConfig = null,
        //    Func<ServiceCollection, Task> config = null,
        //    Func<IServiceProvider, StartOptions<EmtyOptions>, Task> startUp = null) =>
        //    Run<EmtyOptions>(args, clientConfig, config, startUp);

        public static async Task Run <TStartOptions>(
            string[] args, Action <ClientCofiguration> clientConfig = null,
            Func <ServiceCollection, Task> config = null,
            Func <IServiceProvider, StartOptions <TStartOptions>, Task> startUp = null)
        {
            var rootPath   = AppContext.BaseDirectory;
            var collection = new ServiceCollection();

            collection.AddSingleton <IJobManager, JobManager>();

            collection.AddLogging(lb =>
            {
                lb.AddConsole();
                lb.AddProvider(new SendingProvider(GetScopeFactory));
                lb.AddFile(o => o.BasePath = rootPath);
            });
            collection.AddOptions();
            var configuration = GetAppConfig(rootPath);

            if (config != null)
            {
                collection.AddSingleton(configuration);
            }



            var    serviceConfig = GetServiceConfig(rootPath);
            string serviceName   = serviceConfig.GetValue <string>("ServiceName");

            Console.Title = $"Service Name: {serviceName}";

            collection.AddCQRSServices(cofiguration =>
            {
                cofiguration.SetUrls(
                    new Uri(serviceConfig.GetValue <string>("Dispatcher"), UriKind.RelativeOrAbsolute),
                    serviceName,
                    serviceConfig.GetValue <string>("ApiKey"))
                .AddFrom <ServiceStopHandler>()
                .AddFrom <TStartOptions>();

                clientConfig?.Invoke(cofiguration);
            });

            if (config != null)
            {
                await config(collection);
            }

            JobStore.SearchAt <TStartOptions>();

            var provider = collection.BuildServiceProvider();
            await provider.StartCQRS();

            provider.GetRequiredService <IJobManager>().Start();

            _serviceProvider = provider;
            if (startUp != null)
            {
                await startUp(provider, new StartOptions <TStartOptions>(args));
            }

            Console.WriteLine("Service start Compled");
            ExitWaiter.WaitOne();

            provider.GetRequiredService <IJobManager>().Stop();
            await _serviceProvider.GetRequiredService <IDispatcherClient>().Stop();

            ExitWaiter.Dispose();
            provider.Dispose();
        }