Expose more RsFiles via JSON API

FileInfo remove dead static members
This commit is contained in:
Gioacchino Mazzurco 2018-08-23 22:38:21 +02:00
parent 4d30d4f32b
commit afeb408f7a
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
2 changed files with 238 additions and 90 deletions

View file

@ -192,8 +192,11 @@ public:
* This function returns an unspecified amount of bytes. Either as much data
* as available or a sensible maximum. Expect a block size of around 1MiB.
* To get more data, call this function repeatedly with different offsets.
* jsonapi{development} note the missing @ the wrapper for this is written
* manually not autogenerated @see JsonApiServer.
*
* jsonapi{development}
* note the missing @ the wrapper for this is written manually not
* autogenerated @see JsonApiServer.
*
* @param[in] hash hash of the file. The file has to be available on this node
* or it has to be in downloading state.
* @param[in] offset where the desired block starts
@ -240,13 +243,67 @@ public:
*/
virtual bool FileCancel(const RsFileHash& hash) = 0;
virtual bool setDestinationDirectory(const RsFileHash& hash,const std::string& new_path) = 0;
virtual bool setDestinationName(const RsFileHash& hash,const std::string& new_name) = 0;
virtual bool setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy) = 0;
virtual void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy) = 0;
virtual FileChunksInfo::ChunkStrategy defaultChunkStrategy() = 0;
virtual uint32_t freeDiskSpaceLimit() const =0;
virtual void setFreeDiskSpaceLimit(uint32_t size_in_mb) =0;
/**
* @brief Set destination directory for given file
* @jsonapi{development}
* @param[in] hash file identifier
* @param[in] newPath
* @return false if some error occurred, true otherwise
*/
virtual bool setDestinationDirectory(
const RsFileHash& hash, const std::string& newPath ) = 0;
/**
* @brief Set name for dowloaded file
* @jsonapi{development}
* @param[in] hash file identifier
* @param[in] newName
* @return false if some error occurred, true otherwise
*/
virtual bool setDestinationName(
const RsFileHash& hash, const std::string& newName ) = 0;
/**
* @brief Set chunk strategy for file, useful to set streaming mode to be
* able of see video or other media preview while it is still downloading
* @jsonapi{development}
* @param[in] hash file identifier
* @param[in] newStrategy
* @return false if some error occurred, true otherwise
*/
virtual bool setChunkStrategy(
const RsFileHash& hash,
FileChunksInfo::ChunkStrategy newStrategy ) = 0;
/**
* @brief Set default chunk strategy
* @jsonapi{development}
* @param[in] strategy
*/
virtual void setDefaultChunkStrategy(
FileChunksInfo::ChunkStrategy strategy ) = 0;
/**
* @brief Get default chunk strategy
* @jsonapi{development}
* @return current default chunck strategy
*/
virtual FileChunksInfo::ChunkStrategy defaultChunkStrategy() = 0;
/**
* @brief Get free disk space limit
* @jsonapi{development}
* @return current current minimum free space on disk in MB
*/
virtual uint32_t freeDiskSpaceLimit() const = 0;
/**
* @brief Set minimum free disk space limit
* @jsonapi{development}
* @param[in] minimumFreeMB minimum free space in MB
*/
virtual void setFreeDiskSpaceLimit(uint32_t minimumFreeMB) = 0;
virtual bool FileControl(const RsFileHash& hash, uint32_t flags) = 0;
virtual bool FileClearCompleted() = 0;
virtual void setDefaultEncryptionPolicy(uint32_t policy)=0; // RS_FILE_CTRL_ENCRYPTION_POLICY_STRICT/PERMISSIVE
@ -267,21 +324,56 @@ public:
virtual bool changeDownloadSpeed(const RsFileHash& hash, int speed) = 0;
virtual bool getDownloadSpeed(const RsFileHash& hash, int & speed) = 0;
virtual bool clearDownload(const RsFileHash& hash) = 0;
// virtual void getDwlDetails(std::list<DwlDetails> & details) = 0;
/***
* Download / Upload Details.
***/
virtual void FileDownloads(std::list<RsFileHash> &hashs) = 0;
virtual bool FileUploads(std::list<RsFileHash> &hashs) = 0;
virtual bool FileDetails(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) = 0;
/**
* @brief Get incoming files list
* @jsonapi{development}
* @param[out] hashs storage for files identifiers list
*/
virtual void FileDownloads(std::list<RsFileHash>& hashs) = 0;
/**
* @brief Get outgoing files list
* @jsonapi{development}
* @param[out] hashs storage for files identifiers list
* @return false if some error occurred, true otherwise
*/
virtual bool FileUploads(std::list<RsFileHash>& hashs) = 0;
/**
* @brief Get file details
* @jsonapi{development}
* @param[in] hash file identifier
* @param[in] hintflags filtering hint (RS_FILE_HINTS_EXTRA|...|RS_FILE_HINTS_LOCAL)
* @param[out] info storage for file information
* @return true if file found, false otherwise
*/
virtual bool FileDetails(
const RsFileHash &hash, FileSearchFlags hintflags, FileInfo& info ) = 0;
virtual bool isEncryptedSource(const RsPeerId& virtual_peer_id) =0;
/// Gives chunk details about the downloaded file with given hash.
virtual bool FileDownloadChunksDetails(const RsFileHash& hash,FileChunksInfo& info) = 0 ;
/**
* @brief Get chunk details about the downloaded file with given hash.
* @jsonapi{development}
* @param[in] hash file identifier
* @param[out] info storage for file information
* @return true if file found, false otherwise
*/
virtual bool FileDownloadChunksDetails(
const RsFileHash& hash, FileChunksInfo& info) = 0;
/// details about the upload with given hash
virtual bool FileUploadChunksDetails(const RsFileHash& hash,const RsPeerId& peer_id,CompressedChunkMap& map) = 0 ;
/**
* @brief Get details about the upload with given hash
* @jsonapi{development}
* @param[in] hash file identifier
* @param[in] peer_id peer identifier
* @param[out] map storage for chunk info
* @return true if file found, false otherwise
*/
virtual bool FileUploadChunksDetails(
const RsFileHash& hash, const RsPeerId& peer_id,
CompressedChunkMap& map ) = 0;
/***
* Extra List Access