Skip to content

Commit

Permalink
Merge pull request #27 from lynixliu/develop
Browse files Browse the repository at this point in the history
Merge pull request #22, #25 and #26 from Develop
  • Loading branch information
lynixliu committed Mar 25, 2023
2 parents 640aaa5 + 073817b commit ffa48bd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ Primitive type:
* long: Int64
* float: Float
* double: Double
* bytes: [uint8]
* bytes: [UInt8]
* string: String
* fixed: [uint8] or [uint32] for Date
* fixed: [UInt8] or [uint32] for Date

complex type:

Expand Down Expand Up @@ -142,7 +142,7 @@ struct model: Codable {
var b: String = "hello"
}
// add model to containe
// add model to container
try oc1?.addObject(model())
// encode object
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftAvroCore/FileObject/NullCodec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public struct NullCodec: CodecProtocol {
return codec
}

init(codecName: String) {
public init(codecName: String) {
self.codec = codecName
}
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/SwiftAvroCore/IPC/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import Foundation
class MessageResponse {
let avro: Avro
let context: Context
var sessionCache: [[uint8]: AvroProtocol]
var sessionCache: [[UInt8]: AvroProtocol]
var serverResponse: HandshakeResponse

public init(context:Context, serverHash: [uint8], serverProtocol: String) throws {
public init(context:Context, serverHash: [UInt8], serverProtocol: String) throws {
self.avro = Avro()
self.context = context
self.avro.setSchema(schema: context.responseSchema)
self.sessionCache = [[uint8]:AvroProtocol]()
self.sessionCache = [[UInt8]:AvroProtocol]()
self.serverResponse = HandshakeResponse(match: HandshakeMatch.NONE,serverProtocol: serverProtocol, serverHash: serverHash, meta: context.responseMeta)
}

func encodeHandshakeResponse(response: HandshakeResponse) throws -> Data {
return try avro.encode(response)
}
public func addSupportPotocol(protocolString: String, hash: [uint8]) throws {
public func addSupportPotocol(protocolString: String, hash: [UInt8]) throws {
sessionCache[hash] = try JSONDecoder().decode(AvroProtocol.self,from: protocolString.data(using: .utf8)!)
}

Expand Down
5 changes: 0 additions & 5 deletions Sources/SwiftAvroCore/SwiftAvroCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@

import Foundation

#if os(Linux)
typealias uint8 = UInt8
#endif


public class Avro {
private var schema: AvroSchema? = nil
private var schemaEncodingOption: AvroSchemaEncodingOption = .CanonicalForm
Expand Down

0 comments on commit ffa48bd

Please sign in to comment.