Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/LOCODEs are not IR responsibility #534

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 63 additions & 25 deletions netmap/node_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,15 @@ func (x NodeInfo) capacity() uint64 {
return capacity
}

const attrUNLOCODE = "UN-LOCODE"
const (
attrUNLOCODE = "UN-LOCODE"
attrCountryCode = "CountryCode"
attrCountryName = "Country"
attrLocation = "Location"
attrSubDivCode = "SubDivCode"
attrSubDivName = "SubDiv"
attrContinent = "Continent"
)

// SetLOCODE specifies node's geographic location in UN/LOCODE format. Each
// storage node MUST declare it for entrance to the NeoFS network. Node MAY
Expand All @@ -314,55 +322,85 @@ func (x NodeInfo) LOCODE() string {

// SetCountryCode sets code of the country in ISO 3166-1_alpha-2 to which
// storage node belongs (or the closest one).
//
// SetCountryCode is intended only for processing the network registration
// request by the Inner Ring. Other parties SHOULD NOT use it.
func (x *NodeInfo) SetCountryCode(countryCode string) {
x.SetAttribute("CountryCode", countryCode)
x.SetAttribute(attrCountryCode, countryCode)
}

// CountryCode returns node's country code set using SetCountryCode.
//
// Zero NodeInfo has empty country code which is invalid according to
// NeoFS API system requirement.
func (x NodeInfo) CountryCode() string {
return x.Attribute(attrCountryCode)
}

// SetCountryName sets short name of the country in ISO-3166 format to which
// storage node belongs (or the closest one).
//
// SetCountryName is intended only for processing the network registration
// request by the Inner Ring. Other parties SHOULD NOT use it.
func (x *NodeInfo) SetCountryName(country string) {
x.SetAttribute("Country", country)
x.SetAttribute(attrCountryName, country)
}

// CountryName returns node's country name set using SetCountryName.
//
// Zero NodeInfo has empty country name which is invalid according to
// NeoFS API system requirement.
func (x NodeInfo) CountryName() string {
return x.Attribute(attrCountryName)
}

// SetLocationName sets storage node's location name from "NameWoDiacritics"
// column in the UN/LOCODE record corresponding to the specified LOCODE.
//
// SetLocationName is intended only for processing the network registration
// request by the Inner Ring. Other parties SHOULD NOT use it.
func (x *NodeInfo) SetLocationName(location string) {
x.SetAttribute("Location", location)
x.SetAttribute(attrLocation, location)
}

// LocationName returns node's location set using SetLocationName.
//
// Zero NodeInfo has empty location which is invalid according to
// NeoFS API system requirement.
func (x NodeInfo) LocationName() string {
return x.Attribute(attrLocation)
}

// SetSubdivisionCode sets storage node's subdivision code from "SubDiv" column in
// the UN/LOCODE record corresponding to the specified LOCODE.
//
// SetSubdivisionCode is intended only for processing the network registration
// request by the Inner Ring. Other parties SHOULD NOT use it.
func (x *NodeInfo) SetSubdivisionCode(subDiv string) {
x.SetAttribute("SubDivCode", subDiv)
x.SetAttribute(attrSubDivCode, subDiv)
}

// SetSubdivisionName sets storage node's subdivision name in ISO 3166-2 format.
// SubdivisionCode returns node's subdivision code set using SetSubdivisionCode.
//
// SetSubdivisionName is intended only for processing the network registration
// request by the Inner Ring. Other parties SHOULD NOT use it.
// Zero NodeInfo has subdivision code which is invalid according to
// NeoFS API system requirement.
func (x NodeInfo) SubdivisionCode() string {
return x.Attribute(attrSubDivCode)
}

// SetSubdivisionName sets storage node's subdivision name in ISO 3166-2 format.
func (x *NodeInfo) SetSubdivisionName(subDiv string) {
x.SetAttribute("SubDiv", subDiv)
x.SetAttribute(attrSubDivName, subDiv)
}

// SubdivisionName returns node's subdivision name set using SetSubdivisionName.
//
// Zero NodeInfo has subdivision name which is invalid according to
// NeoFS API system requirement.
func (x NodeInfo) SubdivisionName() string {
return x.Attribute(attrSubDivName)
}

// SetContinentName sets name of the storage node's continent from
// Seven-Continent model.
//
// SetContinentName is intended only for processing the network registration
// request by the Inner Ring. Other parties SHOULD NOT use it.
func (x *NodeInfo) SetContinentName(continent string) {
x.SetAttribute("Continent", continent)
x.SetAttribute(attrContinent, continent)
}

// ContinentName returns node's continent set using SetContinentName.
//
// Zero NodeInfo has continent which is invalid according to
// NeoFS API system requirement.
func (x NodeInfo) ContinentName() string {
return x.Attribute(attrContinent)
}

// Enumeration of well-known attributes.
Expand Down
Loading