经过一些试验后,我发现根本不可能使用 Multinode 模块。由于 Multinode 取决于 Entity商店模块,反之亦然。因此,将 multinode 模块包括到实体商店的gradle配置中会导致循环依赖性。
无论如何,我仍在尝试一些黑客。从本质上讲,我发现的主要问题是创建S3BlobVault
,因为(重新(从Xodus项目外部创建S3DataReaderWriterProvider
很容易,主要问题是S3BlobVault
,它需要PersistentEntityStoreImpl
的实例,这意味着它(S3BlobVault
(需要在PersistentEntityStoreImpl
内进行实例化,这是由于循环依赖性问题而不可能的。
至少我确实修改了持久性storeimpl并添加:
public void setBlobVault(BlobVault blobVault) {
this.blobVault = blobVault;
}
然后在我的代码(app(中,我添加了
final PersistentEntityStoreImpl store = PersistentEntityStores.newInstance(environment);
S3BlobVault s3BlobVault = createS3BlobVault(store, environment.getLocation());
store.setBlobVault(s3BlobVault);
创建这样的保险库:
private S3BlobVault createS3BlobVault(PersistentEntityStoreImpl store, String location) {
try {
S3AsyncClient s3 = S3AsyncClient.builder()
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("", "")))
.endpointOverride(new URI("https://s3.wasabisys.com"))
.region(Region.US_EAST_1).build();
S3BlobVault blobVault = null;
// Can't use code below (outside of package)
// try {
// final PersistentSequenceBlobHandleGenerator.PersistentSequenceGetter persistentSequenceGetter =
// new PersistentSequenceBlobHandleGenerator.PersistentSequenceGetter() {
// @Override
// public PersistentSequence get() {
// return getSequence(getAndCheckCurrentTransaction(), BLOB_HANDLES_SEQUENCE);
// }
// };
// blobVault = new S3BlobVault(store,
// new PersistentSequenceBlobHandleGenerator(persistentSequenceGetter), s3, "xodus", location, ".blobs", null);
// } catch (UnexpectedBlobVaultVersionException e) {
// blobVault = null;
// }
if(blobVault == null) {
blobVault = new S3BlobVault(store,
BlobHandleGenerator.IMMUTABLE, s3, "xodus", location, ".blobs", null);
}
return blobVault;
} catch (Exception e) {
throw ExodusException.toExodusException(e);
}
}
我仍然以错误结束:
Caused by: java.io.FileNotFoundException: s3:xodusblobsversion (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at jetbrains.exodus.entitystore.FileSystemBlobVaultOld.<init>(FileSystemBlobVaultOld.java:106)
at jetbrains.exodus.entitystore.FileSystemBlobVaultOld.<init>(FileSystemBlobVaultOld.java:71)
at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.createDefaultFSBlobVault(PersistentEntityStoreImpl.java:424)
... 95 more
在您的项目中,您可以添加对多键jar的依赖性,并以这种方式创建PersitententityStore:
final S3BlobVault blobVault = createBlobVault(...);
final Environment env = Environments.newInstance("location");
final PersistentEntityStoreImpl store = PersistentEntityStores.newInstance(PersistentEntityStoreConfig.DEFAULT, env, blobVault, "entityStore name");
可能,这会起作用。至少,如果您通过斑点库来创建PersistententityStore,那么您将不需要提到的循环依赖。对多键模块的依赖性足以使用实体商店模块的功能。
不过,我必须强调,多键模块中的任何功能都是不完整的,未宣布,没有记录,并且是更改的受试者。它可以在以后的版本中完全删除。
xodus构建1.3.91作为实验特征共享S3功能。文档中没有参考文献也没有用于S3文件存储的一些测试。我们不建议在生产代码中使用它,直到发行说明中没有提及,并且文档中没有任何部分。
目前将S3用作Xodus的商店的结果是不可预测的。