Class ConfigService


  • public class ConfigService
    extends Object
    config service
    Author:
    Nacos
    • Constructor Detail

      • ConfigService

        public ConfigService()
    • Method Detail

      • groupCount

        public static int groupCount()
      • hasGroupKey

        public static boolean hasGroupKey​(String groupKey)
      • dump

        public static boolean dump​(String dataId,
                                   String group,
                                   String tenant,
                                   String content,
                                   long lastModifiedTs,
                                   String type)
        保存配置文件,并缓存md5.
      • dumpBeta

        public static boolean dumpBeta​(String dataId,
                                       String group,
                                       String tenant,
                                       String content,
                                       long lastModifiedTs,
                                       String betaIps)
        保存配置文件,并缓存md5.
      • dumpTag

        public static boolean dumpTag​(String dataId,
                                      String group,
                                      String tenant,
                                      String tag,
                                      String content,
                                      long lastModifiedTs)
        保存配置文件,并缓存md5.
      • dumpChange

        public static boolean dumpChange​(String dataId,
                                         String group,
                                         String tenant,
                                         String content,
                                         long lastModifiedTs)
        保存配置文件,并缓存md5.
      • reloadConfig

        public static void reloadConfig()
      • checkMd5

        public static List<String> checkMd5()
      • remove

        public static boolean remove​(String dataId,
                                     String group,
                                     String tenant)
        删除配置文件,删除缓存。
      • removeBeta

        public static boolean removeBeta​(String dataId,
                                         String group,
                                         String tenant)
        删除配置文件,删除缓存。
      • removeTag

        public static boolean removeTag​(String dataId,
                                        String group,
                                        String tenant,
                                        String tag)
        删除配置文件,删除缓存。
      • updateMd5

        public static void updateMd5​(String groupKey,
                                     String md5,
                                     long lastModifiedTs)
      • updateBetaMd5

        public static void updateBetaMd5​(String groupKey,
                                         String md5,
                                         List<String> ips4Beta,
                                         long lastModifiedTs)
      • updateTagMd5

        public static void updateTagMd5​(String groupKey,
                                        String tag,
                                        String md5,
                                        long lastModifiedTs)
      • getContentMd5

        public static String getContentMd5​(String groupKey)
        返回cache的md5。零长度字符串表示没有该数据。
      • getContentBetaMd5

        public static String getContentBetaMd5​(String groupKey)
        返回cache的md5。零长度字符串表示没有该数据。
      • getContentTagMd5

        public static String getContentTagMd5​(String groupKey,
                                              String tag)
        返回cache的md5。零长度字符串表示没有该数据。
      • getBetaIps

        public static List<String> getBetaIps​(String groupKey)
        返回beta Ip列表
      • getContentCache

        public static CacheItem getContentCache​(String groupKey)
        返回cache。
      • getLastModifiedTs

        public static long getLastModifiedTs​(String groupKey)
      • isUptodate

        public static boolean isUptodate​(String groupKey,
                                         String md5)
      • tryReadLock

        public static int tryReadLock​(String groupKey)
        给数据加读锁。如果成功,后面必须调用releaseReadLock(String),失败则不需要。
        Parameters:
        groupKey -
        Returns:
        零表示没有数据,失败。正数表示成功,负数表示有写锁导致加锁失败。
      • releaseReadLock

        public static void releaseReadLock​(String groupKey)