[#7] Add local tool for building database file #11

Merged
realloc merged 4 commits from george.bartolomey/frostfs-locode-db:feature-local-util into master 2024-09-04 19:50:57 +00:00
2 changed files with 15 additions and 15 deletions
Showing only changes of commit 2cb22574b9 - Show all commits

View file

@ -3,8 +3,8 @@
First, thank you for contributing! We love and encourage pull requests from First, thank you for contributing! We love and encourage pull requests from
everyone. Please follow the guidelines: everyone. Please follow the guidelines:
- Check the open [issues](https://git.frostfs.info/TrueCloudLab/frostfs-node/issues) and - Check the open [issues](https://git.frostfs.info/TrueCloudLab/frostfs-locode-db/issues) and
acid-ant marked this conversation as resolved Outdated

frostfs-node -> frostfs-locode-db
Need to do the same changes for the pull requests too.

frostfs-node -> frostfs-locode-db Need to do the same changes for the `pull requests` too.

I fixed that.

I fixed that.
[pull requests](https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls) for existing [pull requests](https://git.frostfs.info/TrueCloudLab/frostfs-locode-db/pulls) for existing
discussions. discussions.
- Open an issue first, to discuss a new feature or enhancement. - Open an issue first, to discuss a new feature or enhancement.
@ -23,23 +23,23 @@ everyone. Please follow the guidelines:
## Development Workflow ## Development Workflow
Start by forking the `frostfs-node` repository, make changes in a branch and then Start by forking the `frostfs-locode-db` repository, make changes in a branch and then

Need to fix repository name.

Need to fix repository name.

Fixed.

Fixed.
send a pull request. We encourage pull requests to discuss code changes. Here send a pull request. We encourage pull requests to discuss code changes. Here
are the steps in details: are the steps in details:
### Set up your Forgejo repository ### Set up your Forgejo repository
Fork [FrostFS node upstream](https://git.frostfs.info/TrueCloudLab/frostfs-node) source Fork [FrostFS node upstream](https://git.frostfs.info/TrueCloudLab/frostfs-locode-db) source
repository to your own personal repository. Copy the URL of your fork (you will repository to your own personal repository. Copy the URL of your fork (you will
need it for the `git clone` command below). need it for the `git clone` command below).
```sh ```sh
$ git clone https://git.frostfs.info/TrueCloudLab/frostfs-node $ git clone https://git.frostfs.info/TrueCloudLab/frostfs-locode-db
``` ```
### Set up git remote as ``upstream`` ### Set up git remote as ``upstream``
```sh ```sh
$ cd frostfs-node $ cd frostfs-locode-db
$ git remote add upstream https://git.frostfs.info/TrueCloudLab/frostfs-node $ git remote add upstream https://git.frostfs.info/TrueCloudLab/frostfs-locode-db
$ git fetch upstream $ git fetch upstream
$ git merge upstream/master $ git merge upstream/master
... ...

View file

@ -27,7 +27,7 @@ following sources:
## Prerequisites ## Prerequisites
- Latest [frostfs-cli](https://git.frostfs.info/TrueCloudLab/frostfs-node) tool - Go 1.21
## Quick start ## Quick start
@ -41,13 +41,13 @@ $ make
## Building ## Building
Then run frost-cli command to generate boltDB file. Then run frost-cli command to generate UN/LOCODE database.
acid-ant marked this conversation as resolved Outdated

frost-cli -> frostfs-locode-db
boltDB file -> UN/LOCODE database

`frost-cli` -> `frostfs-locode-db` `boltDB file` -> `UN/LOCODE database`

Updated.

Updated.
``` ```
$ frostfs-cli util locode generate --help $ ./frostfs-locode-db generate
generate UN/LOCODE database for FrostFS Generate UN/LOCODE database for FrostFS
Usage: Usage:
frostfs-cli util locode generate [flags] frostfs-locode-db generate [flags]
Flags: Flags:
--airports string Path to OpenFlights airport database (csv) --airports string Path to OpenFlights airport database (csv)
@ -58,7 +58,7 @@ Flags:
--out string Target path for generated database --out string Target path for generated database
--subdiv string Path to UN/LOCODE subdivision database (csv) --subdiv string Path to UN/LOCODE subdivision database (csv)
$ ./frostfs-cli util locode generate \ $ ./frostfs-locode-db generate \
--airports airports.dat \ --airports airports.dat \
--continents continents.geojson \ --continents continents.geojson \
--countries countries.dat \ --countries countries.dat \
@ -69,9 +69,9 @@ $ ./frostfs-cli util locode generate \
**Database generation might take some time!** **Database generation might take some time!**
You can test generated database with `frostfs-cli`. You can test generated database with `frostfs-locode-db`.
acid-ant marked this conversation as resolved Outdated

frostfs-cli -> frostfs-locode-db

`frostfs-cli` -> `frostfs-locode-db`

Done.

Done.
``` ```
$ frostfs-cli util locode info --db locode_db --locode 'RU LED' $ frostfs-locode-db info --db locode_db --locode 'RU LED'
Country: Russia Country: Russia
Location: Saint Petersburg (ex Leningrad) Location: Saint Petersburg (ex Leningrad)
Continent: Europe Continent: Europe