Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

spec: Define ACString type and use it for labels values #590

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sgotti
Copy link
Member

@sgotti sgotti commented Apr 1, 2016

This is related to discussion in #586.

I tried to put some limits on the freeform string trying to keep all the possible use cases (and only ACIs with very strange labels will be broken by this change) without limiting them to only ASCII characters . For example kubernetes has very big limits on label values and force it to be <= 63 chars (http://kubernetes.io/docs/user-guide/labels/).

About the max number of chars I just choosed 255 as a number but it can be changed.


spec: Define ACString type and use it for labels values

Having a label value being a freeform string is coumbersome to use and
query since it can contains non printable characters.
Also having it unlimited can bring to other problems.

This patch adds a ACString type that:

  • is restricted to all unicode printable characters. Such characters
    include letters, marks, numbers, punctuation, symbols, and the ASCII
    space character, from unicode categories L, M, N, P, S and the ASCII
    space character.
  • it MUST be UTF-8 encoded
  • it MUST be be 255 characters or less (not bytes).

This patch starts using this new type for labels values.

Some notes:

  • There isn't a regexp to match the valid chars. In Go we can use
    unicode.IsPrint or strconv.IsPrint
  • This defines that the string MUST be UTF-8 (needed to correctly count
    the number of characters) but this assumption is done everywhere (for
    example json string marshall/unmarshall) when a string is involved. So
    this should probably be defined at the top of the spec?

Having a label value being a freeform string is coumbersome to use and
query since it can contains non printable characters.
Also having it unlimited can bring to other problems.

This patch adds a ACString type that:

* is restricted to all unicode printable characters. Such characters
include letters, marks, numbers, punctuation, symbols, and the ASCII
space character, from unicode categories L, M, N, P, S and the ASCII
space character.
* it MUST be UTF-8 encoded
* it MUST be be 255 characters or less (not bytes).

This patch starts using this new type for labels values.

Some notes:

* There isn't a regexp to match the valid chars. In Go we can use
unicode.IsPrint or strconv.IsPrint

* This defines that the string MUST be UTF-8 (needed to correctly count
the number of characters) but this assumption is done everywhere (for
example json string marshall/unmarshall) when a string is involved. So
this should probably be defined at the top of the spec?
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant