-
Notifications
You must be signed in to change notification settings - Fork 78
=serialization rm 5.2.4 workaround, fix LWWMap with Codable Value (Codable in Proto nesting) #782
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
Conversation
| // return try context.serialization.deserialize(as: T.self, from: .data(data), using: manifest) | ||
| // } | ||
| // | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, cleanup
| // ==== ---------------------------------------------------------------------------------------------------------------- | ||
| // MARK: Top-Level Bytes-Blob Encoder | ||
|
|
||
| // TODO: TopLevelDataEncoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually kind of implements just that I guess :nod:
| func unkeyedContainer() -> UnkeyedEncodingContainer { | ||
| fatalErrorBacktrace("Attempted \(#function) in \(self)") | ||
| // TopLevelProtobufBlobEncoderContainer(superEncoder: self) | ||
| // TopLevelProtobufBlobUnkeyedEncodingContainer(superEncoder: self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though we don't actually need it, good
| try data.encode(to: self.superEncoder) | ||
| try self.superEncoder.store(data: data) | ||
| case let bytes as [UInt8]: | ||
| try self.superEncoder.store(bytes: bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we're not really "encoding" we're just using it and that's great 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fix™
| settings.serialization.register(CRDT.LWWRegister<String?>.self) | ||
| settings.serialization.register(CodableExampleValue.self) | ||
| settings.serialization.register(CRDT.LWWMap<String, CodableExampleValue>.self) | ||
| settings.serialization.register(CRDT.LWWRegister<CodableExampleValue>.self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a bit annoying - but good reminder, to use a LWWMap one has to use a LWWRegister heh :~
| let gossipTwoExpectMap: [String: CodableExampleValue] = ["a": "foo", "aa": "baz", "b": "bar"] | ||
| try self.expectMap(probe: p1, expected: gossipTwoExpectMap) | ||
| try self.expectMap(probe: p2, expected: gossipTwoExpectMap) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would crash hard.
| try data.encode(to: self.superEncoder) | ||
| try self.superEncoder.store(data: data) | ||
| case let bytes as [UInt8]: | ||
| try self.superEncoder.store(bytes: bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fix™
|
I honestly don't understand the 5.2 failure :| |
|
CI is on 5.2.1... 😞 Well, that explains it... this will pass once CI uses 5.2.5 heh -- I could remove the first hack removal commit but we really want to CI on 5.2.5. |
|
@swift-server-bot test this please |
Motivation:
Modifications:
Result:
Commit 2 e86b29e
Motivation:
Modifications:
Result: