Clarification for APIs for third phase- dataupdater

Ralf Habacker ralf.habacker at freenet.de
Tue Sep 15 19:49:05 BST 2020


Am 15.09.20 um 18:56 schrieb Prasun Kumar:
> Hi Ralf,
> I have now hidden the implementation details of DataUpdater class on
> your suggestion using a unique_ptr.
fine :-)
> How should we proceed on the server side?
> I think you would have to create a directory in files area where the
> updated databases would be hosted. I could then update the URL in the
> code.

see https://sourceforge.net/projects/ktoblzcheck/files/ktoblzcheck-data/

>     As bankdata_dir() points to a read only location (by default
>     /usr/share/ktoblzcheck/ on unix like os), there is some work
>     required to provide a writeable location, where the updater can
>     save the download files and ktoblzcheck can read downloaded
>     bankdata files. The rule is to search the writeable location first
>     and then, if no file has been found, the readonly location.
>
>     The writeable location would be on unix like os:
>     /home/xxx/.local/share and on windows: C:\users\xxx\.local\share
>     where C:\users\xxx can be retrieved from the USERPROFILE
>     environment variable.
>
> Yes, that sounds good,
> But in the *current *code, the dated_file list is populated from the
> bankdata_dir() first and if no files are found then it checks for
> BANKDATA_PATH.
> Is there any reson for this?

Yes, bankdata_dir() correlates to the writeable location, specified at
runtime  and BANKDATA_PATH to the read only location specified at comile
time. So it looks that bankdata_dir()  needs to be changed to support a
writeable location.

Also the mentioned dated_file list may be replaced by a public function
returning all supported bank data pathes to simplify code e.g.

    /**
     * Returns the directories where the bankdata may be stored
     * ... The first entry specifies a writeable location.
     *
     * This function was introduced in ktoblzcheck-1.xxx
     */
    static std::vector<std::string>> bankdata_dirs();

Thanks.
> Prasun
>
> On Mon, 7 Sep 2020 at 03:54, Ralf Habacker <ralf.habacker at freenet.de
> <mailto:ralf.habacker at freenet.de>> wrote:
>
>     Am 27.08.20 um 14:53 schrieb Prasun Kumar:
>>     Hi Ralf,
>>
>>         A static function in the class
>>         AccountNumberCheck::updateDatabase(),
>>         which  updates the database when called by the client and
>>         returns the
>>         state of operation e.g
>>
>>           bool AccountNumberCheck::updateDatabase()
>>
>>      
>>     As suggested here:
>>     https://mail.kde.org/pipermail/kde-finance-apps/2020-May/000835.html
>>     I have added an API to update databases as a class,
>>     'DataUpdater'. I have created a separate class for this
>>     as the downloading code is too big to put in one method
>>     considering modularity and also since these methods were
>>     independent of the AccountNumberCheck class. The only required
>>     method I see now is the bankdata_dir() for downloaded
>>     file installation but since it's a static method, it can be
>>     accessed without any AccountNumberCheck object.
>
>     As bankdata_dir() points to a read only location (by default
>     /usr/share/ktoblzcheck/ on unix like os), there is some work
>     required to provide a writeable location, where the updater can
>     save the download files and ktoblzcheck can read downloaded
>     bankdata files. The rule is to search the writeable location first
>     and then, if no file has been found, the readonly location.
>
>     The writeable location would be on unix like os:
>     /home/xxx/.local/share and on windows: C:\users\xxx\.local\share
>     where C:\users\xxx can be retrieved from the USERPROFILE
>     environment variable.
>
>>     Also, since the class is in the same header file, a client
>>     doesn't need to import extra headers, however, they would surely
>>     need to create a DataUpdater object.
>     This looks good except the fact, that there are implementation
>     details in the public header, which would better to placed into a
>     private class following the hints mentioned at
>     https://herbsutter.com/gotw/_100/.
>>
>     Regards
>
>     Ralf
>
>>     On Thu, 27 Aug 2020 at 12:29, Ralf Habacker
>>     <ralf.habacker at freenet.de <mailto:ralf.habacker at freenet.de>> wrote:
>>
>>         Am 18.08.20 um 06:54 schrieb Prasun Kumar:
>>         > Hi mentors,
>>         > I have incorporated most of your suggestions into the
>>         project and I am
>>         > working on the few left.
>>         >
>>         > The remaining milestones in the proposed project are the
>>         creation of API
>>         > to integrate the
>>         > databases into other applications and the additional
>>         subtask of a
>>         > download API to fetch
>>         > updated databases from a server.
>>         >
>>         > The downloading API's flow is somewhat clear to me but it
>>         would be
>>         > helpful to have some pointers
>>         > for the first API.
>>         >
>>
>>         A static function in the class
>>         AccountNumberCheck::updateDatabase(),
>>         which  updates the database when called by the client and
>>         returns the
>>         state of operation e.g
>>
>>           bool AccountNumberCheck::updateDatabase()
>>
>>         or
>>
>>         typedef enum {} UpdateState;
>>
>>         UpdateState AccountNumberCheck::updateDatabase();
>>
>>
>>         Regards
>>         Ralf
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-finance-apps/attachments/20200915/9d392980/attachment-0001.htm>


More information about the Kde-finance-apps mailing list