This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
import _Concurrency | |
extension XCTestCase { | |
func asyncTest( | |
expectationDescription: String? = nil, | |
timeout: TimeInterval = 3, | |
file: StaticString = #file, | |
line: Int = #line, | |
closure: @escaping () async throws -> () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FDB | |
import NIO | |
enum E: Error { | |
case recordExists | |
} | |
let fdb = FDB() | |
let key = "somekey".bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NIO | |
public protocol SyncStorage { | |
associatedtype Key: Hashable | |
associatedtype Value | |
var eventLoops: [EventLoop] { get } | |
func getOrSet( | |
by key: Key, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public extension Dictionary where Key == String, Value == Any { | |
fileprivate func _get<T>(path: [String]) -> T? { | |
var root = self | |
for idx in 0 ..< path.count - 1 { | |
guard let _root = root[path[idx]] as? [String: Any] else { | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import LGNCore | |
import LGNP | |
import LGNPContenter | |
import LGNS | |
import NIO | |
import NIOHTTP1 | |
public extension LGNC { | |
struct HTTP { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Notice no Foundation :3 | |
typealias Byte = UInt8 | |
typealias Bytes = [Byte] | |
func getBytes<Input>(_ input: Input) -> Bytes { | |
return withUnsafeBytes(of: input) { Bytes($0) } | |
} | |
// You must be ABSOLUTELY SURE about input bytes, or enjoy your fresh and crispy BAD_ACCESS runtime error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef FDB_C_OPTIONS_G_H | |
#define FDB_C_OPTIONS_G_H | |
#pragma once | |
/* | |
* FoundationDB C API | |
* | |
* This source file is part of the FoundationDB open source project | |
* | |
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define FDB_API_VERSION 520 | |
#include "foundationdb/fdb_c.h" | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <pthread.h> | |
#include <unistd.h> | |
void checkError(fdb_error_t errorNum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prefix=/usr/local | |
exec_prefix=${prefix} | |
includedir=${prefix}/include | |
libdir=${exec_prefix}/lib | |
Name: fdb | |
Description: FoundationDB macOS library | |
Version: 5.2.5 | |
Cflags: -I${includedir} | |
Libs: -L${libdir} -lfdb_c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func stringIpToInt(_ input: String) -> UInt32 { | |
var result: UInt32 = 0 | |
var i = 0 | |
for part in input.split(separator: ".") { | |
result |= UInt32(part)! << ((3 - i) * 8) | |
i += 1 | |
} | |
return result | |
} |