# enum class

Published articles for enum class.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## IO Activity Tagging

DevFeed: [IO Activity Tagging](<https://devfeed.tech/articles/io-activity-tagging-22394.md>)

Original publisher: [Read original article](<http://rocksdb.org/blog/2025/09/25/io-tagging.html>)

Author: Hui Xiao

Published: 2025-09-25T00:00:00Z

Content type: article

Language: en

Sources: [RocksDB](<https://devfeed.tech/sources/rocksdb.md>)

Topics: [rocksdb](<https://devfeed.tech/topics/rocksdb.md>), [IO](<https://devfeed.tech/topics/io.md>), [systems](<https://devfeed.tech/topics/systems.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [caching](<https://devfeed.tech/tags/caching.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [io](<https://devfeed.tech/tags/io.md>), [management](<https://devfeed.tech/tags/management.md>), [operations](<https://devfeed.tech/tags/operations.md>), [performance](<https://devfeed.tech/tags/performance.md>), [rocksdb](<https://devfeed.tech/tags/rocksdb.md>), [structure](<https://devfeed.tech/tags/structure.md>), [systems](<https://devfeed.tech/tags/systems.md>), [verification](<https://devfeed.tech/tags/verification.md>)

### AI overview

This article explains RocksDB's IOActivity enum, which automatically tags operations such as reads, flushes, compactions, database opens, and verification. The tags are propagated through the storage stack so custom file systems can make activity-aware scheduling, caching, and resource-management decisions. RocksDB also provides per-activity IO time and count histograms.

### Source excerpt

Context RocksDB performs a variety of IO operations--user reads, background compactions, flushes, database opens, and verification tasks. Treating all these operations the same makes it difficult for file system implementers to optimize performance, prioritize latency-sensitive IOs, and diagnose bottlenecks. To solve that, RocksDB internally tags every IO operation with its activity type using the IOActivity enum. This automatic tagging provides precise context for each IO, enabling file systems to make smarter, context-aware decisions for scheduling, caching, and resource management. How Internal IO Tagging Works RocksDB automatically assigns an IOActivity tag to each IO operation. This tag is propagated through the storage stack and included in the IO options passed to the file system. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 enum class IOActivity : uint8_t { kFlush = 0, // IO for flush operations (background write) kCompaction = 1, // IO for compaction (background read/write) kDBOpen = 2, // IO during database open (read/write) kGet = 3, // User Get() read kMultiGet = 4, // User MultiGet() read kDBIterator = 5, // User iterator read kVerifyDBChecksum = 6, // Verification: DB checksum kVerifyFileChecksums = 7, // Verification: file checksums kGetEntity = 8, // Entity Get (e.g., wide-column) kMultiGetEntity = 9, // Entity MultiGet kGetFileChecksumsFromCurrentManifest = 10, // Manifest checksum reads // 0x80-0xFE: Reserved for custom/internal use kUnknown = 0xFF // Unknown/unspecified activity }; Access IO Tag in File System Custom file systems can access the IOActivity tag via the IO options structure provided by RocksDB. This allows them to optimize behavior based on the specific IO activity. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Status CustomFileSystem::Append(uint64_t offset, const Slice& data, const IOOptions& io_opts, ...) { switch (io_opts.io_activity) { case Env::IOActivity::kGet: // Prioritize or cache user reads break; case Env::IOActivity::kCompaction: // T

## Generics

DevFeed: [Generics](<https://devfeed.tech/articles/generics-25057.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-generics/>)

Author: author@typealias.com (Dave Leeds)

Published: 2024-03-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [generics](<https://devfeed.tech/topics/generics.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [classes](<https://devfeed.tech/tags/classes.md>), [collections](<https://devfeed.tech/tags/collections.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [function](<https://devfeed.tech/tags/function.md>), [generics](<https://devfeed.tech/tags/generics.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-generic-function](<https://devfeed.tech/tags/kotlin-generic-function.md>), [kotlin-generics](<https://devfeed.tech/tags/kotlin-generics.md>), [kotlin-parameterized-types](<https://devfeed.tech/tags/kotlin-parameterized-types.md>), [kotlin-type-argument](<https://devfeed.tech/tags/kotlin-type-argument.md>), [kotlin-type-erasure](<https://devfeed.tech/tags/kotlin-type-erasure.md>), [kotlin-type-parameter](<https://devfeed.tech/tags/kotlin-type-parameter.md>), [kotlin-type-parameter-constraint](<https://devfeed.tech/tags/kotlin-type-parameter-constraint.md>), [kotlin-type-safety](<https://devfeed.tech/tags/kotlin-type-safety.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [list](<https://devfeed.tech/tags/list.md>), [map](<https://devfeed.tech/tags/map.md>), [pair](<https://devfeed.tech/tags/pair.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

A tutorial introducing Kotlin generics through collection types such as List, Pair, and Map, using a beverage-menu example with classes and an enum class.

### Source excerpt

All the way back in Chapter 8, when we introduced collections, we saw our first generic type: List<String> ... then we saw more generics in Chapter 9 when we looked at the Pair and Map classes. In order to stay focused on learning about collection types, we glossed over the details about these classes. Well, we've put off learning about them for long enough! It's finally time for us to gain a full understanding of generics, so buckle up!

## Enum classes in Kotlin

DevFeed: [Enum classes in Kotlin](<https://devfeed.tech/articles/enum-classes-in-kotlin-39330.md>)

Original publisher: [Read original article](<https://kt.academy/article/kfde-enum>)

Published: 2023-02-01T00:01:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [enum class](<https://devfeed.tech/topics/enum-class.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [abstract-class](<https://devfeed.tech/tags/abstract-class.md>), [class](<https://devfeed.tech/tags/class.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [enums](<https://devfeed.tech/tags/enums.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [property](<https://devfeed.tech/tags/property.md>), [superclass](<https://devfeed.tech/tags/superclass.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This Kotlin tutorial explains how to define and use enum classes to represent finite sets of values. It covers enum values and their order, companion object utilities, exhaustive when conditions, stored state, and custom methods.

### Source excerpt

What are enum classes in Kotlin and how do we use them.

## Unconfined Enums Adapter for Moshi

DevFeed: [Unconfined Enums Adapter for Moshi](<https://devfeed.tech/articles/unconfined-enums-adapter-for-moshi-25914.md>)

Original publisher: [Read original article](<https://medium.com/@xxfast/unconfined-enums-adapter-for-moshi-5d84542c8bf0?source=rss-43bae76e8f81------2>)

Author: Isuru Rajapakse

Published: 2022-05-11T12:08:49Z

Content type: tutorial

Language: en

Sources: [Stories by Isuru Rajapakse on Medium](<https://devfeed.tech/sources/stories-by-isuru-rajapakse-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [LineageOS](<https://devfeed.tech/topics/lineageos.md>), [API](<https://devfeed.tech/topics/api.md>), [enum](<https://devfeed.tech/topics/enum.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [moshi](<https://devfeed.tech/tags/moshi.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>)

### AI overview

This tutorial presents a Kotlin pattern for handling previously unknown enum-like values from REST APIs with Moshi. It explains Moshi enum adapters, the unknown-value fallback, and an interface-based approach that preserves the server's raw value instead of mapping it only to a generic unknown value.

### Source excerpt

If you wonder what an Unconfined Enum is, wonder no more because it is a thing I just made up. Enums by definition are confined, or finite. Therefore "unconfined enum" is really an oxymoron. Nevertheless, say you have this Fruit enum and want to map each value to an Android string resource. Kotlin's enum properties make this convenient enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange) } When we want to consume this enum from a Restful API with a Moshi converter, Moshi automatically generates the enum adapter for you, but if you want to customise the behaviour for whatever reason, you can do object FruitsAdapter { @ToJson fun toJson(type: Fruit): String = type.name @FromJson fun fromJson(name: String): Fruit = Fruit.values().first { it.name == name } } Happy days. Everything is working as expected. When things go bananascom.squareup.moshi.JsonDataException: Expected one of [Apple, Oranges] but was Bananas at path $ Good APIs don't break contracts. Not all APIs are good APIs, so some can break contracts. What do we do now? push out an update with added enum value and its string resource? Perhaps we can make use of EnumJsonAdapter's .withUnknownFallBack() enum class Fruit(@StringRes val stringRes: Int) { Apple(R.string.fruit_apple), Oranges(R.string.fruit_orange), Unknown(R.string.fruit_unknown) } Moshi.Builder() .add(KotlinJsonAdapterFactory()) .add(Fruit::class.java, EnumJsonAdapter.create(Fruit::class.java) .withUnknownFallback(Fruit.Unknown)) .build() This certainly stops the app from crashing, but what if we actually want to show the "bananas" that the API sends? you know, as a fail safe so that users wouldn't end up seeing "unknowns". Let's open up the Enums Enums are by definition finite. Enums are final by design. Enums can't be subclassed but they still can inherit interfaces. We will exploit this to create our "unconfined" enum interface Fruit { val name: String data class Unknown(override val name:

## Enum Classes in Kotlin

DevFeed: [Enum Classes in Kotlin](<https://devfeed.tech/articles/enum-classes-in-kotlin-25054.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-enum-classes/>)

Author: author@typealias.com (Dave Leeds)

Published: 2020-10-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [enum](<https://devfeed.tech/tags/enum.md>), [enum-class](<https://devfeed.tech/tags/enum-class.md>), [enumeration](<https://devfeed.tech/tags/enumeration.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

A Kotlin tutorial chapter introduces enum classes as a special kind of class for representing a limited number of values.

### Source excerpt

In the last chapter, we created our very own type, called Circle, using a feature in Kotlin called a class. In this chapter, we're going to look at a special kind of class--an enum class--which is particularly useful when we want to represent a limited number of values. I hope you like Schnauzers, because this chapter is full of them! Limiting the Values Schnauzers are amazing dogs--they're smart, they're loyal to their owners, and they seem to have an opinion about everything!