Skip to content
This repository has been archived by the owner on Jan 3, 2021. It is now read-only.

Conform Context and Manager to EventLoopGroup #20

Merged
merged 2 commits into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sources/Meow/Context.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation
import MongoKitten
import NIO
import Dispatch

// A 🐈 Context
public final class Context {
Expand Down Expand Up @@ -329,6 +330,16 @@ public final class Context {
}
}

extension Context: EventLoopGroup {
public func shutdownGracefully(queue: DispatchQueue, _ callback: @escaping (Error?) -> Void) {
eventLoop.shutdownGracefully(queue: queue, callback)
}

public func next() -> EventLoop {
return self.eventLoop
}
}

public enum DecodeResult<M> {
case success(M)
case failure(Error, Document)
Expand Down
11 changes: 11 additions & 0 deletions Sources/Meow/Manager.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@_exported import MongoKitten
import NIO
import Dispatch

/// A Meow
public final class Manager {
Expand All @@ -20,3 +21,13 @@ public final class Manager {
}

}

extension Manager: EventLoopGroup {
public func next() -> EventLoop {
return self.eventLoop
}

public func shutdownGracefully(queue: DispatchQueue, _ callback: @escaping (Error?) -> Void) {
eventLoop.shutdownGracefully(queue: queue, callback)
}
}