|
|
@@ -1,9 +1,6 @@
|
|
|
import cn.reghao.dfs.store.DfsStoreApplication;
|
|
|
-import cn.reghao.dfs.store.db.mapper.DataBlockMapper;
|
|
|
import cn.reghao.dfs.store.db.mapper.FileMetaMapper;
|
|
|
-import cn.reghao.dfs.store.model.po.DataBlock;
|
|
|
import cn.reghao.dfs.store.model.po.FileMeta;
|
|
|
-import cn.reghao.jutil.jdk.security.DigestUtil;
|
|
|
import cn.reghao.oss.api.dto.ObjectMeta;
|
|
|
import cn.reghao.dfs.store.redis.ds.RedisStringObj;
|
|
|
import cn.reghao.jutil.jdk.db.Page;
|
|
|
@@ -15,9 +12,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
-import java.security.NoSuchAlgorithmException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -54,13 +48,6 @@ public class RedisTest {
|
|
|
List<ObjectMeta> list = fileMetaMapper.findObjectMetaByPage(page);
|
|
|
while (!list.isEmpty()) {
|
|
|
list.forEach(objectMeta -> {
|
|
|
- /*List<DataBlock> list1 = dataBlockMapper.findByObjectId(objectMeta.getObjectId());
|
|
|
- if (list1.isEmpty()) {
|
|
|
- return;
|
|
|
- }*
|
|
|
- String absolutePath = list1.get(0).getAbsolutePath();
|
|
|
- objectMeta.setAbsolutePath(absolutePath);*/
|
|
|
-
|
|
|
String objectName = objectMeta.getObjectName();
|
|
|
String key1 = key + objectName;
|
|
|
redisString.set(key1, objectMeta);
|
|
|
@@ -72,21 +59,4 @@ public class RedisTest {
|
|
|
log.info("page -> {}", pageNumber);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- @Autowired
|
|
|
- DataBlockMapper dataBlockMapper;
|
|
|
- private void checkLocalFile(File file) throws IOException, NoSuchAlgorithmException {
|
|
|
- log.error("--------------------------------------");
|
|
|
- String absolutePath = file.getAbsolutePath();
|
|
|
- DataBlock dataBlock = dataBlockMapper.findByPath(absolutePath);
|
|
|
- if (dataBlock == null) {
|
|
|
- log.error("{} not exist in data_block", absolutePath);
|
|
|
- }
|
|
|
-
|
|
|
- String sha256sum = DigestUtil.sha256sum(absolutePath);
|
|
|
- FileMeta fileMeta = fileMetaMapper.findBySha256sum(sha256sum);
|
|
|
- if (fileMeta == null) {
|
|
|
- log.error("{} not exist in file_meta", absolutePath);
|
|
|
- }
|
|
|
- }
|
|
|
}
|