jacek-lewandowski commented on code in PR #2064:
URL: https://github.com/apache/cassandra/pull/2064#discussion_r1090239891


##########
src/java/org/apache/cassandra/io/sstable/Component.java:
##########
@@ -35,43 +41,49 @@
 {
     public static final char separator = '-';
 
-    final static EnumSet<Type> TYPES = EnumSet.allOf(Type.class);
+    final static ImmutableSet<Type> TYPES = Type.all;
 
     /**
      * WARNING: Be careful while changing the names or string representation 
of the enum
      * members. Streaming code depends on the names during streaming (Ref: 
CASSANDRA-14556).
      */
-    public enum Type
+    public static class Type
     {
+        private final static List<Type> singletonsCollector = new 
ArrayList<>(11);
         // the base data for an sstable: the remaining components can be 
regenerated
         // based on the data component
-        DATA("Data.db"),
-        // index of the row keys with pointers to their positions in the data 
file
-        PRIMARY_INDEX("Index.db"),
-        // serialized bloom filter for the row keys in the sstable
-        FILTER("Filter.db"),
+        public static final Type DATA = new Type("DATA", "Data.db", name -> 
Component.DATA);
         // file to hold information about uncompressed data length, chunk 
offsets etc.
-        COMPRESSION_INFO("CompressionInfo.db"),
+        public static final Type COMPRESSION_INFO = new 
Type("COMPRESSION_INFO", "CompressionInfo.db", name -> 
Component.COMPRESSION_INFO);
         // statistical metadata about the content of the sstable
-        STATS("Statistics.db"),
+        public static final Type STATS = new Type("STATS", "Statistics.db", 
name -> Component.STATS);
+        // serialized bloom filter for the row keys in the sstable
+        public static final Type FILTER = new Type("FILTER", "Filter.db", name 
-> Component.FILTER);
         // holds CRC32 checksum of the data file
-        DIGEST("Digest.crc32"),
+        public static final Type DIGEST = new Type("DIGEST","Digest.crc32", 
name -> Component.DIGEST);
         // holds the CRC32 for chunks in an a uncompressed file.
-        CRC("CRC.db"),
-        // holds SSTable Index Summary (sampling of Index component)
-        SUMMARY("Summary.db"),
+        public static final Type CRC = new Type("CRC","CRC.db", name -> 
Component.CRC);
         // table of contents, stores the list of all components for the sstable
-        TOC("TOC.txt"),
+        public static final Type TOC = new Type("TOC","TOC.txt", name -> 
Component.TOC);
         // built-in secondary index (may be multiple per sstable)
-        SECONDARY_INDEX("SI_.*.db"),
+        public static final Type SECONDARY_INDEX = new 
Type("SECONDARY_INDEX","SI_.*.db", name -> new Component(Type.SECONDARY_INDEX, 
name));
         // custom component, used by e.g. custom compaction strategy
-        CUSTOM(null);
+        public static final Type CUSTOM = new Type("CUSTOM",null, name -> new 
Component(Type.CUSTOM, name));
 
-        final String repr;
+        public static final ImmutableSet<Type> all = 
ImmutableSet.copyOf(singletonsCollector);

Review Comment:
   yes, more work is in some next commit, just wanted you to take an overview 
of the direction



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to