Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/main/java/com/tidesdb/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,32 @@ public Builder maxOpenSSTables(long maxOpenSSTables) {
}

public Config build() {
validate();
return new Config(this);
}

private void validate() throws IllegalArgumentException {
if (dbPath == null) {
throw new IllegalArgumentException("Database path cannot be null");
}
if (dbPath.isEmpty()) {
dbPath = "";
}
if (numFlushThreads <= 0) {
throw new IllegalArgumentException("Number of flush threads must be positive");
}
if (numCompactionThreads <= 0) {
throw new IllegalArgumentException("Number of compaction threads must be positive");
}
if (logLevel == null) {
throw new IllegalArgumentException("Log level cannot be null");
}
if (blockCacheSize < 0) {
throw new IllegalArgumentException("Block cache size cannot be negative");
}
if (maxOpenSSTables <= 0) {
throw new IllegalArgumentException("Max open SSTables must be positive");
}
}
}
}
Loading