class ModelStorateThinClientProcessor implements CustomQueryProcessor {

    private ClientResponse moveFile(long reqId, BinaryRawReader reader) {
        String from = reader.readString();
        String to = reader.readString();

        String[] pathsToLock = new String[] {from, to};
        Arrays.sort(pathsToLock, (s1, s2) -> {
            if (s1.length() == s2.length())
                return s1.compareTo(s2);
            else
                return Integer.compare(s1.length(), s2.length());
        });

        return modelStorage.lockPaths(() -> {
            if (!modelStorage.exists(from))
                return error(reqId, "File not found [path=" + from + "]");
            if (modelStorage.exists(to))
                return error(reqId, "File already exists [path=" + to + "]");
            if (!modelStorage.isFile(from))
                return error(reqId, "File is not regular file [path=" + from + "]");

            byte[] file = modelStorage.getFile(from);
            modelStorage.remove(from);
            modelStorage.putFile(to, file);
            return new ClientResponse(reqId);
        }, pathsToLock);
    }

    public  ModelStorateThinClientProcessor(ModelStorage modelStorage);

}