问题描述
经过多次试验,我发现根本无法使用 multinode 模块.由于 multinode 依赖于 entity-store 模块,反之亦然.因此,将 multinode 模块包含在实体商店的Gradle配置中会导致循环依赖.
After quite some trials, I find that it is not possible to use the multinode module at all. Since the multinode depends on entity-store module and vice versa.Thus including the multinode module into Gradle config of entity-store causes circular dependency.
无论如何,我仍在尝试一些技巧.从本质上讲,我发现的主要问题是S3BlobVault
的创建,因为很容易从Xodus项目外部(重新)创建S3DataReaderWriterProvider
,所以主要的问题是S3BlobVault
,它需要,这意味着(S3BlobVault
)需要在PersistentEntityStoreImpl
之内/之内实例化,由于循环依赖问题,这是不可能的.
Anyhow, I am still trying some hacks. Essentially the major issue I find is the creation of the S3BlobVault
, since it is easy to (re)create the S3DataReaderWriterProvider
from outside the Xodus project, the major issue is the S3BlobVault
which needs an instance of the PersistentEntityStoreImpl
which means it(the S3BlobVault
) needs to be instantiated within/inside the PersistentEntityStoreImpl
which is quite not possible due to circular dependency issue.
至少我确实修改了PersistentEntityStoreImpl并添加了:
At the very least I did modify the PersistentEntityStoreImpl and added:
public void setBlobVault(BlobVault blobVault) {
this.blobVault = blobVault;
}
然后在我的代码(应用)中,我添加了
Then in my code(app), I added
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:xodus\blobs\version (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:
In your project, you can add dependency on the multinode jar and create PersitentEntityStore in such a way:
final S3BlobVault blobVault = createBlobVault(...);
final Environment env = Environments.newInstance("location");
final PersistentEntityStoreImpl store = PersistentEntityStores.newInstance(PersistentEntityStoreConfig.DEFAULT, env, blobVault, "entityStore name");
这可能行得通.至少,如果您通过Blob保管库来创建PersistentEntityStore,那么您将不需要您提到的循环依赖项.对多节点模块的依赖足以使用实体存储模块的功能.
Probably, this would work. At least, if you pass the blob vault for creation of PersistentEntityStore then you wouldn't require the circular dependency you mentioned.Dependency on the multinode module is enough to use functionality of the entity-store module.
不过,我要强调的是,多节点模块中的任何功能都是不完整的,未声明,未记录且可能会发生变化.在将来的版本中可能会完全删除它.
Though, I have to emphasize that any functionality in the multinode module is incomplete, not announced, not documented, and is a subject to change. It may be removed completely in future versions.
这篇关于多节点模块(Xodus)的循环依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!