diff --git a/src/main/java/com/fanruan/api/cluster/FineLockKit.java b/src/main/java/com/fanruan/api/cluster/FineLockKit.java new file mode 100644 index 0000000..a047c75 --- /dev/null +++ b/src/main/java/com/fanruan/api/cluster/FineLockKit.java @@ -0,0 +1,33 @@ +package com.fanruan.api.cluster; + +import com.fr.collections.utils.FineLockUtils; + +/** + * Redis实现的集群锁工具类. + * + * 需要在{@link com.fr.store.StateServiceActivator}启动后使用. + * + * @author Dylan.Liu + * @version 10.0 + * Created by Dylan.Liu on 2021/2/2 + */ +public class FineLockKit { + + /** + * 加锁. + * + * @param lockName 锁名 + */ + public static void lockViaFineLock(String lockName) { + FineLockUtils.lockViaFineLock(lockName); + } + + /** + * 解锁. + * + * @param lockName 锁名 + */ + public static void unlockViaFineLock(String lockName) { + FineLockUtils.unlockViaFineLock(lockName); + } +} diff --git a/src/main/java/com/fanruan/api/cluster/resource/FineFileServerKit.java b/src/main/java/com/fanruan/api/cluster/resource/FineFileServerKit.java index eadcef1..e29247d 100644 --- a/src/main/java/com/fanruan/api/cluster/resource/FineFileServerKit.java +++ b/src/main/java/com/fanruan/api/cluster/resource/FineFileServerKit.java @@ -2,6 +2,7 @@ package com.fanruan.api.cluster.resource; import com.fr.decision.fileserver.FineFileServer; import com.fr.io.config.RepositoryConfig; +import com.fr.io.repository.ResourceRepository; /** * 文件服务器Kit. @@ -22,4 +23,15 @@ public class FineFileServerKit { return FineFileServer.getInstance().getRepoConfig(); } + /** + * 文件服务器读写权限测试. + * + * @param repo 仓库 + * @param workRoot 工作路径 + * @return 是否有读写权限 + */ + public static boolean hasReadWritePermission(ResourceRepository repo, String workRoot) { + return FineFileServer.getInstance().hasReadWritePermission(repo, workRoot); + } + }