Skip to content

feather-framework/feather-storage-ephemeral

Repository files navigation

Feather Storage Ephemeral

Ephemeral (in-memory) driver implementation for the abstract Feather Storage Swift API package.

Release: 1.0.0-beta.2

Features

  • Ephemeral (in-memory) driver for Feather Storage
  • Designed for modern Swift concurrency
  • DocC-based API Documentation
  • Unit tests and code coverage

Requirements

Swift 6.1+ Platforms: Linux, macOS, iOS, tvOS, watchOS, visionOS

  • Swift 6.1+
  • Platforms:
    • Linux
    • macOS 15+
    • iOS 18+
    • tvOS 18+
    • watchOS 11+
    • visionOS 2+

Installation

Add the dependency to your Package.swift:

.package(url: "https://github.com/feather-framework/feather-storage-ephemeral", exact: "1.0.0-beta.2"),

Then add FeatherStorageEphemeral to your target dependencies:

.product(name: "FeatherStorageEphemeral", package: "feather-storage-ephemeral"),

Usage

API documentation is available at the link below:

DocC API documentation

Here is a brief example:

import NIOCore
import FeatherStorage
import FeatherStorageEphemeral

let storage = StorageClientEphemeral()

let text = "Hello, World"
var buffer = ByteBufferAllocator().buffer(capacity: text.utf8.count)
buffer.writeString(text)
    
try await storage.upload(
    key: "docs/hello.txt",
    sequence: StorageSequence(
        asyncSequence: ByteBufferSequence(buffer: buffer),
        length: UInt64(buffer.readableBytes)
    )
)

try await storage.exists(key: "docs/hello.txt")
try await storage.size(key: "docs/hello.txt")

let result = try await storage.download(key: "docs/hello.txt", range: nil)
let buffer = try await result.collect(upTo: .max)
let value = buffer.getString(at: 0, length: buffer.readableBytes)
print(value)

Warning

This repository is a work in progress, things can break until it reaches v1.0.0.

Other storage drivers

The following storage client implementations are also available for use:

Development

  • Build: swift build
  • Test:
    • local: swift test
    • using Docker: make docker-test
  • Format: make format
  • Check: make check

Contributing

Pull requests are welcome. Please keep changes focused and include tests for new logic. 🙏

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Contributors