cn.hyperchain.sdk.service.impl.ArchiveServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of litesdk Show documentation
Show all versions of litesdk Show documentation
A Java client tool for Hyperchain
package cn.hyperchain.sdk.service.impl;
import cn.hyperchain.sdk.provider.ProviderManager;
import cn.hyperchain.sdk.request.ArchiveRequest;
import cn.hyperchain.sdk.request.Request;
import cn.hyperchain.sdk.response.archive.ArchiveBoolResponse;
import cn.hyperchain.sdk.response.archive.ArchiveFilterIdResponse;
import cn.hyperchain.sdk.response.archive.ArchiveResponse;
import cn.hyperchain.sdk.service.ArchiveService;
import java.math.BigInteger;
public class ArchiveServiceImpl implements ArchiveService {
public static final String ARCHIVE_PRE = "archive_";
public ProviderManager providerManager;
public ArchiveServiceImpl(ProviderManager providerManager) {
this.providerManager = providerManager;
}
@Override
public Request snapshot(BigInteger blockNumber, int... nodeIds) {
return snapshot(blockNumber.toString(), nodeIds);
}
@Override
public Request snapshot(String blockNumber, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "snapshot", providerManager, ArchiveFilterIdResponse.class, nodeIds);
archiveRequest.addParams(blockNumber);
return archiveRequest;
}
@Override
public Request querySnapshotExist(String filterId, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "querySnapshotExist", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(filterId);
return archiveRequest;
}
@Override
public Request checkSnapshot(String filterId, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "checkSnapshot", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(filterId);
return archiveRequest;
}
@Override
public Request deleteSnapshot(String filterId, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "deleteSnapshot", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(filterId);
return archiveRequest;
}
@Override
public Request listSnapshot(int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "listSnapshot", providerManager, ArchiveResponse.class, nodeIds);
return archiveRequest;
}
@Override
public Request readSnapshot(String filterId, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "readSnapshot", providerManager, ArchiveResponse.class, nodeIds);
archiveRequest.addParams(filterId);
return archiveRequest;
}
@Override
public Request archive(String filterId, boolean sync, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "archive", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(filterId);
archiveRequest.addParams(sync);
return archiveRequest;
}
@Override
public Request archiveNoPredict(BigInteger blkNumber, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "archiveNoPredict", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(blkNumber);
return archiveRequest;
}
@Override
public Request restore(String filterId, boolean sync, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "restore", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(filterId);
archiveRequest.addParams(sync);
return archiveRequest;
}
@Override
public Request restoreAll(boolean sync, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "restoreAll", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(sync);
return archiveRequest;
}
@Override
public Request queryArchive(String filterId, int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "queryArchive", providerManager, ArchiveBoolResponse.class, nodeIds);
archiveRequest.addParams(filterId);
return archiveRequest;
}
@Override
public Request pending(int... nodeIds) {
ArchiveRequest archiveRequest = new ArchiveRequest(ARCHIVE_PRE + "pending", providerManager, ArchiveResponse.class, nodeIds);
return archiveRequest;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy