|
@@ -35,17 +35,15 @@ public class PartUploadService {
|
|
|
private final StoreNodeMapper storeNodeMapper;
|
|
private final StoreNodeMapper storeNodeMapper;
|
|
|
private final UploadTaskMapper uploadTaskMapper;
|
|
private final UploadTaskMapper uploadTaskMapper;
|
|
|
private final RpcService rpcService;
|
|
private final RpcService rpcService;
|
|
|
- private final FileMetaMapper fileMetaMapper;
|
|
|
|
|
private final UploadChannelMapper uploadChannelMapper;
|
|
private final UploadChannelMapper uploadChannelMapper;
|
|
|
|
|
|
|
|
public PartUploadService(ObjectRepository objectRepository, StoreNodeMapper storeNodeMapper,
|
|
public PartUploadService(ObjectRepository objectRepository, StoreNodeMapper storeNodeMapper,
|
|
|
- UploadTaskMapper uploadTaskMapper, RpcService rpcService, FileMetaMapper fileMetaMapper,
|
|
|
|
|
|
|
+ UploadTaskMapper uploadTaskMapper, RpcService rpcService,
|
|
|
UploadChannelMapper uploadChannelMapper) {
|
|
UploadChannelMapper uploadChannelMapper) {
|
|
|
this.objectRepository = objectRepository;
|
|
this.objectRepository = objectRepository;
|
|
|
this.storeNodeMapper = storeNodeMapper;
|
|
this.storeNodeMapper = storeNodeMapper;
|
|
|
this.uploadTaskMapper = uploadTaskMapper;
|
|
this.uploadTaskMapper = uploadTaskMapper;
|
|
|
this.rpcService = rpcService;
|
|
this.rpcService = rpcService;
|
|
|
- this.fileMetaMapper = fileMetaMapper;
|
|
|
|
|
this.uploadChannelMapper = uploadChannelMapper;
|
|
this.uploadChannelMapper = uploadChannelMapper;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -53,8 +51,8 @@ public class PartUploadService {
|
|
|
String uploadId = UUID.randomUUID().toString().replace("-", "");
|
|
String uploadId = UUID.randomUUID().toString().replace("-", "");
|
|
|
long size = uploadPrepare.getSize();
|
|
long size = uploadPrepare.getSize();
|
|
|
String sha256sum = uploadPrepare.getSha256sum();
|
|
String sha256sum = uploadPrepare.getSha256sum();
|
|
|
- DataBlock dataBlock = objectRepository.getBySha256sum(sha256sum);
|
|
|
|
|
- List<FileMeta> fileMetaList = fileMetaMapper.findBySha256sum(sha256sum);
|
|
|
|
|
|
|
+ DataBlock dataBlock = objectRepository.getDataBlockBySha256sum(sha256sum);
|
|
|
|
|
+ List<FileMeta> fileMetaList = objectRepository.getFileMetaBySha256sum(sha256sum);
|
|
|
UploadPrepareRet uploadPrepareRet;
|
|
UploadPrepareRet uploadPrepareRet;
|
|
|
long randomOffset = 0;
|
|
long randomOffset = 0;
|
|
|
if (dataBlock != null && !fileMetaList.isEmpty()) {
|
|
if (dataBlock != null && !fileMetaList.isEmpty()) {
|
|
@@ -83,7 +81,7 @@ public class PartUploadService {
|
|
|
long offset = uploadTask.getOffset();
|
|
long offset = uploadTask.getOffset();
|
|
|
int length = uploadTask.getLength();
|
|
int length = uploadTask.getLength();
|
|
|
String sha256sum = uploadTask.getSha256sum();
|
|
String sha256sum = uploadTask.getSha256sum();
|
|
|
- DataBlock dataBlock = objectRepository.getBySha256sum(sha256sum);
|
|
|
|
|
|
|
+ DataBlock dataBlock = objectRepository.getDataBlockBySha256sum(sha256sum);
|
|
|
String hostPort = dataBlock.getHostPort();
|
|
String hostPort = dataBlock.getHostPort();
|
|
|
String[] arr = hostPort.split(":");
|
|
String[] arr = hostPort.split(":");
|
|
|
String host = arr[0];
|
|
String host = arr[0];
|
|
@@ -99,7 +97,7 @@ public class PartUploadService {
|
|
|
int channelCode = uploadTask.getChannelCode();
|
|
int channelCode = uploadTask.getChannelCode();
|
|
|
UploadChannel uploadChannel = uploadChannelMapper.findByCreateByAndChannelCode(uploadBy, channelCode);
|
|
UploadChannel uploadChannel = uploadChannelMapper.findByCreateByAndChannelCode(uploadBy, channelCode);
|
|
|
String channelPrefix = uploadChannel.getPrefix();
|
|
String channelPrefix = uploadChannel.getPrefix();
|
|
|
- List<FileMeta> fileMetaList = fileMetaMapper.findBySha256sum(sha256sum);
|
|
|
|
|
|
|
+ List<FileMeta> fileMetaList = objectRepository.getFileMetaBySha256sum(sha256sum);
|
|
|
if (!fileMetaList.isEmpty()) {
|
|
if (!fileMetaList.isEmpty()) {
|
|
|
FileMeta fileMeta0 = fileMetaList.getFirst();
|
|
FileMeta fileMeta0 = fileMetaList.getFirst();
|
|
|
String objectId = uploadTask.getUploadId();
|
|
String objectId = uploadTask.getUploadId();
|