Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MobileNativeFoundation/Store
A Kotlin Multiplatform library for building network-resilient applications
https://github.com/MobileNativeFoundation/Store
android browser cache desktop guava-cache ios kotlin-multiplatform node offline-first
Last synced: 3 months ago
JSON representation
A Kotlin Multiplatform library for building network-resilient applications
- Host: GitHub
- URL: https://github.com/MobileNativeFoundation/Store
- Owner: MobileNativeFoundation
- License: apache-2.0
- Created: 2019-12-05T18:58:10.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T12:44:44.000Z (4 months ago)
- Last Synced: 2024-09-29T09:24:36.785Z (4 months ago)
- Topics: android, browser, cache, desktop, guava-cache, ios, kotlin-multiplatform, node, offline-first
- Language: Kotlin
- Homepage: https://mobilenativefoundation.github.io/Store/
- Size: 15.4 MB
- Stars: 3,166
- Watchers: 68
- Forks: 198
- Open Issues: 55
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-kotlin-multiplatform - Store - A Kotlin Multiplatform library for building network-resilient applications. (Libraries / Repository)
- awesome-list - MobileNativeFoundation/Store - A Kotlin Multiplatform solution for working with data. Whether youβre building alone or with a team of thousands, Store can help (Kotlin)
- kmp-awesome - Store 5 - Kotlin Library for Async Data Loading and Caching (Libraries / π¦ Storage)
README
Store5
[![codecov](https://codecov.io/gh/MobileNativeFoundation/Store/branch/main/graph/badge.svg?token=0UCmG3QHPf)](https://codecov.io/gh/MobileNativeFoundation/Store)
### Concepts
- [Store](https://mobilenativefoundation.github.io/Store/store/store/) is a typed repository that returns a flow
of [Data](https://github.com/MobileNativeFoundation/Store/blob/main/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/StoreReadResponse.kt#L39)
/[Loading](https://github.com/MobileNativeFoundation/Store/blob/main/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/StoreReadResponse.kt#L34)
/[Error](https://github.com/MobileNativeFoundation/Store/blob/main/store/src/commonMain/kotlin/org/mobilenativefoundation/store/store5/StoreReadResponse.kt#L51)
from local and network data sources
- [MutableStore](https://mobilenativefoundation.github.io/Store/mutable-store/building/overview/) is a mutable repository implementation that allows create **(C)**, read **(R)**,
update **(U)**, and delete **(D)** operations for local and network resources
- [SourceOfTruth](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/source-of-truth/) persists items
- [Fetcher](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/fetcher/) defines how data will be fetched over network
- [Updater](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/updater/) defines how local changes will be pushed to network
- [Bookkeeper](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/bookkeeper/) tracks metadata of local changes and records
synchronization failures
- [Validator](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/validator/) returns whether an item is valid
- [Converter](https://mobilenativefoundation.github.io/Store/mutable-store/building/implementations/converter/) converts items
between [Network](https://mobilenativefoundation.github.io/Store/mutable-store/building/generics/network)
/[Local](https://mobilenativefoundation.github.io/Store/mutable-store/building/generics/sot)
/[Output](https://mobilenativefoundation.github.io/Store/mutable-store/building/generics/common) representations### Including Store In Your Project
#### Android
```kotlin
implementation "org.mobilenativefoundation.store:store5:5.1.0-alpha05"
```#### Multiplatform (Common, JVM, Native, JS)
```kotlin
commonMain {
dependencies {
implementation("org.mobilenativefoundation.store:store5:5.1.0-alpha05")
}
}
```### Getting Started
#### Building Your First Store
```kotlin
StoreBuilder
.from(fetcher, sourceOfTruth)
.converter(converter)
.validator(validator)
.build(updater, bookkeeper)
```#### Creating
##### Request
```kotlin
store.write(
request = StoreWriteRequest.of(
key = key,
value = value
)
)
```##### Response
```text
1. StoreWriteResponse.Success.Typed(response)
```#### Reading
##### Request
```kotlin
store.stream(request = StoreReadRequest.cached(key, refresh = false))
```##### Response
```text
1. StoreReadResponse.Data(value, origin = StoreReadResponseOrigin.Cache)
```#### Updating
##### Request
```kotlin
store.write(
request = StoreWriteRequest.of(
key = key,
value = newValue
)
)
```##### Response
```text
1. StoreWriteResponse.Success.Typed(response)
```#### Deleting
##### Request
```kotlin
store.clear(key)
```### License
```text
Copyright (c) 2024 Mobile Native Foundation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
```