Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async NonBlockingFileIO #704

Merged
merged 16 commits into from
Mar 31, 2024
Merged

Async NonBlockingFileIO #704

merged 16 commits into from
Mar 31, 2024

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Dec 21, 2023

Use async NonBlockingFileIO calls
Updates for AWSHTTPClient protocol

@adam-fowler adam-fowler changed the base branch from main to 7.x.x December 21, 2023 18:48
@adam-fowler adam-fowler force-pushed the async-nonblocking-fileio branch 2 times, most recently from fafd664 to 0bee30b Compare December 22, 2023 09:46
@adam-fowler adam-fowler changed the title NIOFileSystem, URLSession Async NonBlockingFileIO Mar 25, 2024
@adam-fowler adam-fowler requested a review from 0xTim March 25, 2024 17:05
Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outdated comment needs updating

let threadPool = NIOThreadPool(numberOfThreads: 1)
threadPool.start()
defer { threadPool.shutdownGracefully { _ in }}
let fileIO = NonBlockingFileIO(threadPool: threadPool)

let fileBuffer = try await loadFile(path: tokenFile, on: eventLoop, using: fileIO).get()
let fileBuffer = try await loadFile(path: tokenFile, using: fileIO)
let token = String(buffer: fileBuffer)
return token
}

/// Load a file from disk without blocking the current thread
/// - Returns: Event loop future with file contents in a byte-buffer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs updating as it no longer returns a future

@adam-fowler adam-fowler merged commit 4428183 into 7.x.x Mar 31, 2024
6 checks passed
@adam-fowler adam-fowler deleted the async-nonblocking-fileio branch March 31, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants