I am a novice programmer who pretty much does fun things for sake of experimentation. As I’m sure everyone knows, things are less fun when documentation is years out of date and things don’t do as written on the can.
At the moment I’ve written a little tool for calculating probabilities within a fairly large set of nodes, interrelated with probability functions. To speed up calculations I’m caching paths already followed.
In my alternative universe, the calculations will be done by thousands of individual clients across a distributed network, then submitted to the cache.
None of this so far is really relevant to the question.
From what I’ve read, FoundationDB seems to be perfect – except for figuring out how to use it from a Swift client.
I’ve installed FoundationDB and it responds from the command line. In my app, I’ve added a dependency to FDBSwift.
Problem is, as soon as I try to connect to the database I get an error FDB/Helpers.swift:57: Fatal error: Unexpectedly found nil while unwrapping an Optional value
.
The problem appears to be a line in that file which force unwraps the string value of a byte array beginning with \xff, followed by /status/json
.
This isn’t surprising since the method in the package (to check the database is alive) specifically calls the routine with that data. My understanding is the 0xff is to access the database metadata etc. The decoding part is for the purpose of logging the request.
So how can a string decoded from those bytes (in ascii) ever be anything other than nil (and then crashing on the forced unwrap)?
Am I the only person who uses FoundationDB from Swift? What do other people do?
In short, is it possible to use FoundationDB from a Swift client without having to learn how to interoperate with other languages etc?