mapdb icon indicating copy to clipboard operation
mapdb copied to clipboard

MapDB should provide provide a mechanism to easily switch between different Configurations

Open buko opened this issue 6 years ago • 1 comments

Problem: Quickly switch between MapDB Configurations

Very often application developers want to use one Configuration during development (say in memory) and another Configuration in production (say transactions enabled etc). This kind of seamless switching Configuration is difficult with MapDB because the builder pattern is used to create Databases. Attach files by dragging & dropping, , or pasting from the clipboard. Styling with Markdown is supported

Proposed Solution: A Configuration Interface rather than the Builder Pattern

MapDB should provide a single Configuration interface that captures the options of the DB. A quick sketch (though you might want to fundamentally distinguish between In-Memory Configuration and Persistent Configuration):

public interface DBConfiguration {

        public enum StorageMedia {
		Memory, Disk
	}
	
	public enum Durability {
		WriteAheadLog, Periodic
	}
	
	public enum FileType {
		MemoryMappedFile, FileChannel, RandomAccessFile 
	}
	
	public Durability getDurability();
	
	public FileType getFileType();

       public StorageMedia getStorageMedia();
}

MapDB should also provide a default implementation of this interface, DefaultDBConfiguration, with the appropriate getters and setters.

Finally, a nice to have (though not necessary): the ability to read/write configuration from a properties file ie 'DBConfiguration config = DefaultDBConfiguration.build(Properties)`.

(I figure some might not like this but it's worth a shot. I find myself writing a lot of code to deal with MapDB configuration because I want try out different configurations.

buko avatar May 08 '18 11:05 buko

hello ,can i look your pom dependencies

sunyaf avatar Jun 21 '19 03:06 sunyaf