Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook up DAGStorageProvider using SPI
Signed-off-by: Gabriel Roldan <gabriel.roldan@gmail.com>
- Loading branch information
Showing
10 changed files
with
127 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...i/src/main/java/org/locationtech/geogig/model/internal/HeapDAGStorageProviderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Copyright (c) 2019 Boundless and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/org/documents/edl-v10.html | ||
* | ||
* Contributors: | ||
* Gabriel Roldan - initial implementation | ||
*/ | ||
package org.locationtech.geogig.model.internal; | ||
|
||
import org.locationtech.geogig.storage.ObjectStore; | ||
|
||
import lombok.NonNull; | ||
|
||
public class HeapDAGStorageProviderFactory implements DAGStorageProviderFactory { | ||
|
||
/** | ||
* @return {@code 0}, lowest priority | ||
*/ | ||
public @Override int getPriority() { | ||
return 0; | ||
} | ||
|
||
public @Override DAGStorageProvider newInstance(@NonNull ObjectStore treeStore) { | ||
return new HeapDAGStorageProvider(treeStore); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ources/META-INF/services/org.locationtech.geogig.model.internal.DAGStorageProviderFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.locationtech.geogig.model.internal.HeapDAGStorageProviderFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...in/java/org/locationtech/geogig/tempstorage/rocksdb/RocksdbDAGStorageProviderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* Copyright (c) 2019 Boundless and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/org/documents/edl-v10.html | ||
* | ||
* Contributors: | ||
* Gabriel Roldan - initial implementation | ||
*/ | ||
package org.locationtech.geogig.tempstorage.rocksdb; | ||
|
||
import org.locationtech.geogig.model.internal.DAGStorageProvider; | ||
import org.locationtech.geogig.model.internal.DAGStorageProviderFactory; | ||
import org.locationtech.geogig.storage.ObjectStore; | ||
|
||
import lombok.NonNull; | ||
|
||
public class RocksdbDAGStorageProviderFactory implements DAGStorageProviderFactory { | ||
|
||
/** | ||
* @return {@code 1}, next highest priority than (heap) default one | ||
*/ | ||
public @Override int getPriority() { | ||
return 1; | ||
} | ||
|
||
public @Override DAGStorageProvider newInstance(@NonNull ObjectStore treeStore) { | ||
return new RocksdbDAGStorageProvider(treeStore); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ources/META-INF/services/org.locationtech.geogig.model.internal.DAGStorageProviderFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.locationtech.geogig.tempstorage.rocksdb.RocksdbDAGStorageProviderFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...ava/org/locationtech/geogig/tempstorage/rocksdb/RocksdbDAGStorageProviderFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Copyright (c) 2019 Boundless and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/org/documents/edl-v10.html | ||
* | ||
* Contributors: | ||
* Gabriel Roldan - initial implementation | ||
*/ | ||
package org.locationtech.geogig.tempstorage.rocksdb; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
import org.locationtech.geogig.model.ServiceFinder; | ||
import org.locationtech.geogig.model.internal.DAGStorageProviderFactory; | ||
|
||
public class RocksdbDAGStorageProviderFactoryTest { | ||
|
||
public final @Test void testServicePriority() { | ||
DAGStorageProviderFactory defaultService = new ServiceFinder() | ||
.lookupDefaultService(DAGStorageProviderFactory.class); | ||
assertTrue(defaultService instanceof RocksdbDAGStorageProviderFactory); | ||
} | ||
|
||
} |