private List<Method> receiveFileMethod() {
        List<Method> methods = new ArrayList<>();
        methods.add(new Method(RECEIVE_META_METHOD, "sssl*", "ii", this::receiveFileMeta)
                .requireCapabilities(Capability.CLIENT__FILERECEIVER_API)
                .paramDesc(0, "filereference", "file reference to download")
                .paramDesc(1, "filename", "filename")
                .paramDesc(2, "type", "'file' or 'compressed'")
                .paramDesc(3, "filelength", "length in bytes of file")
                .paramDesc(3, "compressionType", "compression type: gzip, lz4, zstd")
                .returnDesc(0, "ret", "0 if success, 1 otherwise")
                .returnDesc(1, "session-id", "Session id to be used for this transfer"));
        methods.add(new Method(RECEIVE_PART_METHOD, "siix", "i", this::receiveFilePart)
                .requireCapabilities(Capability.CLIENT__FILERECEIVER_API)
                .paramDesc(0, "filereference", "file reference to download")
                .paramDesc(1, "session-id", "Session id to be used for this transfer")
                .paramDesc(2, "partid", "relative part number starting at zero")
                .paramDesc(3, "data", "bytes in this part")
                .returnDesc(0, "ret", "0 if success, 1 otherwise"));
        methods.add(new Method(RECEIVE_EOF_METHOD, "silis", "i", this::receiveFileEof)
                .requireCapabilities(Capability.CLIENT__FILERECEIVER_API)
                .paramDesc(0, "filereference", "file reference to download")
                .paramDesc(1, "session-id", "Session id to be used for this transfer")
                .paramDesc(2, "crc-code", "crc code (xxhash64)")
                .paramDesc(3, "error-code", "Error code. 0 if none")
                .paramDesc(4, "error-description", "Error description.")
                .returnDesc(0, "ret", "0 if success, 1 if crc mismatch, 2 otherwise"));
        return methods;
    }
When asking for a file reference, this handles RPC callbacks from config server with file data and metadata.
Uses the same Supervisor as the original caller that requests files, so communication uses the same
connection in both directions.

@author baldersheim
filedistribution/src/main/java/com/yahoo/vespa/filedistribution/FileReceiver.java