forked from TrueCloudLab/frostfs-node
[#1320] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
parent
d99800ee93
commit
cc7a723d77
182 changed files with 802 additions and 802 deletions
|
@ -41,8 +41,8 @@ type record struct {
|
|||
lng string
|
||||
}
|
||||
|
||||
// Get scans records of the OpenFlights Airport to in-memory table (once),
|
||||
// and returns entry that matches passed UN/LOCODE record.
|
||||
// Get scans the records of the OpenFlights Airport to an in-memory table (once),
|
||||
// and returns an entry that matches the passed UN/LOCODE record.
|
||||
//
|
||||
// Records are matched if they have the same country code and either
|
||||
// same IATA code or same city name (location name in UN/LOCODE).
|
||||
|
@ -90,8 +90,8 @@ const (
|
|||
countryFldNum
|
||||
)
|
||||
|
||||
// CountryName scans records of the OpenFlights Country table to in-memory table (once),
|
||||
// and returns name of the country by code.
|
||||
// CountryName scans the records of the OpenFlights Country table to an in-memory table (once),
|
||||
// and returns the name of the country by code.
|
||||
//
|
||||
// Returns locodedb.ErrCountryNotFound if no entry matches.
|
||||
func (db *DB) CountryName(code *locodedb.CountryCode) (name string, err error) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
// Open opens underlying BoltDB instance.
|
||||
// Open opens an underlying BoltDB instance.
|
||||
//
|
||||
// Timeout of BoltDB opening is 3s (only for Linux or Darwin).
|
||||
//
|
||||
|
@ -33,7 +33,7 @@ func (db *DB) Open() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Close closes underlying BoltDB instance.
|
||||
// Close closes an underlying BoltDB instance.
|
||||
//
|
||||
// Must not be called before successful Open call.
|
||||
func (db *DB) Close() error {
|
||||
|
@ -94,10 +94,10 @@ func recordFromValue(data []byte) (*locodedb.Record, error) {
|
|||
return r, nil
|
||||
}
|
||||
|
||||
// Put saves the record by key in underlying BoltDB instance.
|
||||
// Put saves the record by key in an underlying BoltDB instance.
|
||||
//
|
||||
// Country code from key is used for allocating the 1st level buckets.
|
||||
// Records are stored in country buckets by location code from key.
|
||||
// Country code from the key is used for allocating the 1st level buckets.
|
||||
// Records are stored in country buckets by the location code from the key.
|
||||
// The records are stored in internal binary JSON format.
|
||||
//
|
||||
// Must not be called before successful Open call.
|
||||
|
|
|
@ -58,7 +58,7 @@ func (c Continent) String() string {
|
|||
}
|
||||
|
||||
// ContinentFromString returns Continent value
|
||||
// corresponding to passed string representation.
|
||||
// corresponding to the passed string representation.
|
||||
func ContinentFromString(str string) Continent {
|
||||
switch str {
|
||||
default:
|
||||
|
|
|
@ -12,8 +12,8 @@ import (
|
|||
|
||||
const continentProperty = "Continent"
|
||||
|
||||
// PointContinent goes through all polygons, and returns continent
|
||||
// in which point is located.
|
||||
// PointContinent goes through all polygons and returns the continent
|
||||
// in which the point is located.
|
||||
//
|
||||
// Returns locodedb.ContinentUnknown if no entry matches.
|
||||
//
|
||||
|
|
|
@ -6,12 +6,12 @@ import (
|
|||
locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column"
|
||||
)
|
||||
|
||||
// CountryCode represents country code for
|
||||
// storage in the NeoFS location database.
|
||||
// CountryCode represents a country code for
|
||||
// the storage in the NeoFS location database.
|
||||
type CountryCode locodecolumn.CountryCode
|
||||
|
||||
// CountryCodeFromString parses string UN/LOCODE country code
|
||||
// and returns CountryCode.
|
||||
// CountryCodeFromString parses a string UN/LOCODE country code
|
||||
// and returns a CountryCode.
|
||||
func CountryCodeFromString(s string) (*CountryCode, error) {
|
||||
cc, err := locodecolumn.CountryCodeFromString(s)
|
||||
if err != nil {
|
||||
|
@ -21,7 +21,7 @@ func CountryCodeFromString(s string) (*CountryCode, error) {
|
|||
return CountryFromColumn(cc)
|
||||
}
|
||||
|
||||
// CountryFromColumn converts UN/LOCODE country code to CountryCode.
|
||||
// CountryFromColumn converts a UN/LOCODE country code to a CountryCode.
|
||||
func CountryFromColumn(cc *locodecolumn.CountryCode) (*CountryCode, error) {
|
||||
return (*CountryCode)(cc), nil
|
||||
}
|
||||
|
|
|
@ -59,14 +59,14 @@ var ErrCountryNotFound = errors.New("country not found")
|
|||
|
||||
// NamesDB is an interface of the NeoFS location namespace.
|
||||
type NamesDB interface {
|
||||
// Must resolve country code to country name.
|
||||
// Must resolve a country code to a country name.
|
||||
//
|
||||
// Must return ErrCountryNotFound if there is no
|
||||
// country with provided code.
|
||||
// country with the provided code.
|
||||
CountryName(*CountryCode) (string, error)
|
||||
|
||||
// Must resolve (country code, subdivision code) to
|
||||
// subdivision name.
|
||||
// a subdivision name.
|
||||
//
|
||||
// Must return ErrSubDivNotFound if either country or
|
||||
// subdivision is not presented in database.
|
||||
|
@ -152,8 +152,8 @@ func FillDatabase(table SourceTable, airports AirportDB, continents ContinentsDB
|
|||
})
|
||||
}
|
||||
|
||||
// LocodeRecord returns record from the NeoFS location database
|
||||
// corresponding to string representation of UN/LOCODE.
|
||||
// LocodeRecord returns the record from the NeoFS location database
|
||||
// corresponding to the string representation of UN/LOCODE.
|
||||
func LocodeRecord(db DB, sLocode string) (*Record, error) {
|
||||
lc, err := locode.FromString(sLocode)
|
||||
if err != nil {
|
||||
|
|
|
@ -6,12 +6,12 @@ import (
|
|||
locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column"
|
||||
)
|
||||
|
||||
// LocationCode represents location code for
|
||||
// storage in the NeoFS location database.
|
||||
// LocationCode represents a location code for
|
||||
// the storage in the NeoFS location database.
|
||||
type LocationCode locodecolumn.LocationCode
|
||||
|
||||
// LocationCodeFromString parses string UN/LOCODE location code
|
||||
// and returns LocationCode.
|
||||
// LocationCodeFromString parses a string UN/LOCODE location code
|
||||
// and returns a LocationCode.
|
||||
func LocationCodeFromString(s string) (*LocationCode, error) {
|
||||
lc, err := locodecolumn.LocationCodeFromString(s)
|
||||
if err != nil {
|
||||
|
@ -21,7 +21,7 @@ func LocationCodeFromString(s string) (*LocationCode, error) {
|
|||
return LocationFromColumn(lc)
|
||||
}
|
||||
|
||||
// LocationFromColumn converts UN/LOCODE country code to LocationCode.
|
||||
// LocationFromColumn converts a UN/LOCODE country code to a LocationCode.
|
||||
func LocationFromColumn(cc *locodecolumn.LocationCode) (*LocationCode, error) {
|
||||
return (*LocationCode)(cc), nil
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@ import (
|
|||
locodecolumn "github.com/nspcc-dev/neofs-node/pkg/util/locode/column"
|
||||
)
|
||||
|
||||
// Point represents 2D geographic point.
|
||||
// Point represents a 2D geographic point.
|
||||
type Point struct {
|
||||
lat, lng float64
|
||||
}
|
||||
|
||||
// NewPoint creates, initializes and returns new Point.
|
||||
// NewPoint creates, initializes and returns a new Point.
|
||||
func NewPoint(lat, lng float64) *Point {
|
||||
return &Point{
|
||||
lat: lat,
|
||||
|
@ -20,17 +20,17 @@ func NewPoint(lat, lng float64) *Point {
|
|||
}
|
||||
}
|
||||
|
||||
// Latitude returns Point's latitude.
|
||||
// Latitude returns the Point's latitude.
|
||||
func (p Point) Latitude() float64 {
|
||||
return p.lat
|
||||
}
|
||||
|
||||
// Longitude returns Point's longitude.
|
||||
// Longitude returns the Point's longitude.
|
||||
func (p Point) Longitude() float64 {
|
||||
return p.lng
|
||||
}
|
||||
|
||||
// PointFromCoordinates converts UN/LOCODE coordinates to Point.
|
||||
// PointFromCoordinates converts a UN/LOCODE coordinates to a Point.
|
||||
func PointFromCoordinates(crd *locodecolumn.Coordinates) (*Point, error) {
|
||||
if crd == nil {
|
||||
return nil, nil
|
||||
|
|
|
@ -33,12 +33,12 @@ func NewKey(lc locode.LOCODE) (*Key, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// CountryCode returns location's country code.
|
||||
// CountryCode returns the location's country code.
|
||||
func (k *Key) CountryCode() *CountryCode {
|
||||
return k.cc
|
||||
}
|
||||
|
||||
// LocationCode returns location code.
|
||||
// LocationCode returns the location code.
|
||||
func (k *Key) LocationCode() *LocationCode {
|
||||
return k.lc
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ type Record struct {
|
|||
|
||||
var errParseCoordinates = errors.New("invalid coordinates")
|
||||
|
||||
// NewRecord calculates Record from UN/LOCODE table record.
|
||||
// NewRecord calculates the Record from the UN/LOCODE table record.
|
||||
func NewRecord(r locode.Record) (*Record, error) {
|
||||
crd, err := locodecolumn.CoordinatesFromString(r.Coordinates)
|
||||
if err != nil {
|
||||
|
@ -79,42 +79,42 @@ func NewRecord(r locode.Record) (*Record, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// CountryName returns country name.
|
||||
// CountryName returns the country name.
|
||||
func (r *Record) CountryName() string {
|
||||
return r.countryName
|
||||
}
|
||||
|
||||
// SetCountryName sets country name.
|
||||
// SetCountryName sets the country name.
|
||||
func (r *Record) SetCountryName(name string) {
|
||||
r.countryName = name
|
||||
}
|
||||
|
||||
// LocationName returns location name.
|
||||
// LocationName returns the location name.
|
||||
func (r *Record) LocationName() string {
|
||||
return r.locationName
|
||||
}
|
||||
|
||||
// SetLocationName sets location name.
|
||||
// SetLocationName sets the location name.
|
||||
func (r *Record) SetLocationName(name string) {
|
||||
r.locationName = name
|
||||
}
|
||||
|
||||
// SubDivCode returns subdivision code.
|
||||
// SubDivCode returns the subdivision code.
|
||||
func (r *Record) SubDivCode() string {
|
||||
return r.subDivCode
|
||||
}
|
||||
|
||||
// SetSubDivCode sets subdivision code.
|
||||
// SetSubDivCode sets the subdivision code.
|
||||
func (r *Record) SetSubDivCode(name string) {
|
||||
r.subDivCode = name
|
||||
}
|
||||
|
||||
// SubDivName returns subdivision name.
|
||||
// SubDivName returns the subdivision name.
|
||||
func (r *Record) SubDivName() string {
|
||||
return r.subDivName
|
||||
}
|
||||
|
||||
// SetSubDivName sets subdivision name.
|
||||
// SetSubDivName sets the subdivision name.
|
||||
func (r *Record) SetSubDivName(name string) {
|
||||
r.subDivName = name
|
||||
}
|
||||
|
@ -129,12 +129,12 @@ func (r *Record) SetGeoPoint(p *Point) {
|
|||
r.p = p
|
||||
}
|
||||
|
||||
// Continent returns location continent.
|
||||
// Continent returns the location continent.
|
||||
func (r *Record) Continent() *Continent {
|
||||
return r.cont
|
||||
}
|
||||
|
||||
// SetContinent sets location continent.
|
||||
// SetContinent sets the location continent.
|
||||
func (r *Record) SetContinent(c *Continent) {
|
||||
r.cont = c
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue