3 Commits

Author SHA1 Message Date
brent saner
edf1c53800 add to todo 2025-09-30 15:49:54 -04:00
brent saner
cefca8ad91 v1.0.3
FIXED:
* Link in README
* ReadConnResponse was not properly reading in the response status byte
  before checking the checksum, leading to receiving/parsing Response
  messages from a net.Conn *always* failing with an errs.ErrBadHdr.
  This has been rectified.
2025-09-30 14:15:00 -04:00
brent saner
a86367b5b9 fix readme link to module 2025-09-24 17:00:17 -04:00
4 changed files with 135 additions and 6 deletions

View File

@@ -23,7 +23,7 @@ Last rendered {localdatetime}
[id="ref"] [id="ref"]
== Reference == Reference
In addition to the documentation found in this document and https://wireproto.io/[the specification^], library usage documentation can be found at https://pkg.go.dev/go.pkg.dev/r00t2.io/WireProto[the Golang module documentation page^]: In addition to the documentation found in this document and https://wireproto.io/[the specification^], library usage documentation can be found at https://pkg.go.dev/r00t2.io/wireproto[the Golang module documentation page^]:
++++ ++++
<a href="https://go.pkg.dev/r00t2.io/wireproto"> <a href="https://go.pkg.dev/r00t2.io/wireproto">
@@ -57,3 +57,16 @@ The following are a wishlist or things planned that may come in later versions.
** This of course won't work for serializing and keeping *order* of children (e.g. RG => Record); that'd still need to be ordered, but it will allow for parallel parsing *of* those children. Should benchmark, though; it may not be worth it. ** This of course won't work for serializing and keeping *order* of children (e.g. RG => Record); that'd still need to be ordered, but it will allow for parallel parsing *of* those children. Should benchmark, though; it may not be worth it.
* `context.Context` support for `Read*` and `Write*` funcs * `context.Context` support for `Read*` and `Write*` funcs
** This is a relatively low priority as the passed `net.Conn` will likely return an error if its own context is canceled. This can be handled in the caller downstream. ** This is a relatively low priority as the passed `net.Conn` will likely return an error if its own context is canceled. This can be handled in the caller downstream.
* Better/more strict interfaces
* Maps for generic should have `any`, not `interface{}` values
* FVP should have its own method to a map[string][]byte return value
* "Getters and Setters" (ew, I know, but compromises are made with flexibility)
** `.Append*()` methods to append any type to any parent type. e.g. `<Response>.AppendFVP(<FieldValuePair>)` would append an FVP to the most recent ResponseRecord to the most recent ResponseRecordGroup (or create if they don't exist), `<Response>.AppendRecord(...)` for appending a record to most recent record group etc.
** `.Get()`/`.Set()` on a Response/Request to get/set a slice of values (`<FieldValue>`) from filter criteria as struct (e.g. field name, how many, first X, last X, etc.)
** `.GetPath*()` and `.SetPath*()` to use *[`RG_N`[`R_N`[`FVP_N`]]]* indexing (e.g. `0, 0, 0` for RecordGroup 0/Record 0/FVP 0, `1, 3, 5` for RecordGroup 1/Record 3/FVP 5, etc.) multidimentional indexing
*** Allow specific lookups/sets by multidimentional array index to return FVP (`.GetIndex(idx)` where `idx` is a fixed-size array of dimensions for object's children paths); e.g. `<Response>.GetIndex(idx)`, `idx` is `[3]int` and returns FVP)
*** Allow lookups/sets by variable length index (`.GetIndexDynamic(idx)`, where `idx` is a `1` to `n`-size slice of dimensions for object's children paths (e.g. `<Response>.GetIndexDynamic([]int{0, 0})` returns `any(<Record>)` but `<Response>.GetIndexDynamic([]int{0, 0, 0})` returns `any(FieldValuePair)`)
**** negative value indicates *all* children
*** Lookups/sets at fixed levels (e.g. `<RecordGroup>.GetRecord(idx)`, `idx` is `[1]int`, but `<RecordGroup>.GetFVP(idx)`, `idx` is `[2]int`) for type safety
*** All objects have `.ID()` that returns their index/"path"/"key" from the root, and `.Index()` that returns their index within their immediate parent
**** This obviously requires a `.Resolve()` first

View File

@@ -559,7 +559,7 @@ pre.rouge .gs {
<div class="details"> <div class="details">
<span id="author" class="author">Brent Saner</span><br> <span id="author" class="author">Brent Saner</span><br>
<span id="email" class="email"><a href="mailto:bts@square-r00t.net">bts@square-r00t.net</a></span><br> <span id="email" class="email"><a href="mailto:bts@square-r00t.net">bts@square-r00t.net</a></span><br>
<span id="revdate">Last rendered 2025-08-28 01:26:10 -0400</span> <span id="revdate">Last rendered 2025-09-30 15:49:54 -0400</span>
</div> </div>
<div id="toc" class="toc2"> <div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div> <div id="toctitle">Table of Contents</div>
@@ -575,7 +575,7 @@ pre.rouge .gs {
<h2 id="ref"><a class="link" href="#ref">1. Reference</a></h2> <h2 id="ref"><a class="link" href="#ref">1. Reference</a></h2>
<div class="sectionbody"> <div class="sectionbody">
<div class="paragraph"> <div class="paragraph">
<p>In addition to the documentation found in this document and <a href="https://wireproto.io/" target="_blank" rel="noopener">the specification</a>, library usage documentation can be found at <a href="https://pkg.go.dev/go.pkg.dev/r00t2.io/WireProto" target="_blank" rel="noopener">the Golang module documentation page</a>:</p> <p>In addition to the documentation found in this document and <a href="https://wireproto.io/" target="_blank" rel="noopener">the specification</a>, library usage documentation can be found at <a href="https://pkg.go.dev/r00t2.io/wireproto" target="_blank" rel="noopener">the Golang module documentation page</a>:</p>
</div> </div>
<a href="https://go.pkg.dev/r00t2.io/wireproto"> <a href="https://go.pkg.dev/r00t2.io/wireproto">
<img src="https://pkg.go.dev/badge/r00t2.io/wireproto.svg" <img src="https://pkg.go.dev/badge/r00t2.io/wireproto.svg"
@@ -659,6 +659,61 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
</ul> </ul>
</div> </div>
</li> </li>
<li>
<p>Better/more strict interfaces</p>
</li>
<li>
<p>Maps for generic should have <code>any</code>, not <code>interface{}</code> values</p>
</li>
<li>
<p>FVP should have its own method to a map[string][]byte return value</p>
</li>
<li>
<p>"Getters and Setters" (ew, I know, but compromises are made with flexibility)</p>
<div class="ulist">
<ul>
<li>
<p><code>.Append*()</code> methods to append any type to any parent type. e.g. <code>&lt;Response&gt;.AppendFVP(&lt;FieldValuePair&gt;)</code> would append an FVP to the most recent ResponseRecord to the most recent ResponseRecordGroup (or create if they don&#8217;t exist), <code>&lt;Response&gt;.AppendRecord(&#8230;&#8203;)</code> for appending a record to most recent record group etc.</p>
</li>
<li>
<p><code>.Get()</code>/<code>.Set()</code> on a Response/Request to get/set a slice of values (<code>&lt;FieldValue&gt;</code>) from filter criteria as struct (e.g. field name, how many, first X, last X, etc.)</p>
</li>
<li>
<p><code>.GetPath*()</code> and <code>.SetPath*()</code> to use <strong>[<code>RG_N</code>[<code>R_N</code>[<code>FVP_N</code>]]]</strong> indexing (e.g. <code>0, 0, 0</code> for RecordGroup 0/Record 0/FVP 0, <code>1, 3, 5</code> for RecordGroup 1/Record 3/FVP 5, etc.) multidimentional indexing</p>
<div class="ulist">
<ul>
<li>
<p>Allow specific lookups/sets by multidimentional array index to return FVP (<code>.GetIndex(idx)</code> where <code>idx</code> is a fixed-size array of dimensions for object&#8217;s children paths); e.g. <code>&lt;Response&gt;.GetIndex(idx)</code>, <code>idx</code> is <code>[3]int</code> and returns FVP)</p>
</li>
<li>
<p>Allow lookups/sets by variable length index (<code>.GetIndexDynamic(idx)</code>, where <code>idx</code> is a <code>1</code> to <code>n</code>-size slice of dimensions for object&#8217;s children paths (e.g. <code>&lt;Response&gt;.GetIndexDynamic([]int{0, 0})</code> returns <code>any(&lt;Record&gt;)</code> but <code>&lt;Response&gt;.GetIndexDynamic([]int{0, 0, 0})</code> returns <code>any(FieldValuePair)</code>)</p>
<div class="ulist">
<ul>
<li>
<p>negative value indicates <strong>all</strong> children</p>
</li>
</ul>
</div>
</li>
<li>
<p>Lookups/sets at fixed levels (e.g. <code>&lt;RecordGroup&gt;.GetRecord(idx)</code>, <code>idx</code> is <code>[1]int</code>, but <code>&lt;RecordGroup&gt;.GetFVP(idx)</code>, <code>idx</code> is <code>[2]int</code>) for type safety</p>
</li>
<li>
<p>All objects have <code>.ID()</code> that returns their index/"path"/"key" from the root, and <code>.Index()</code> that returns their index within their immediate parent</p>
<div class="ulist">
<ul>
<li>
<p>This obviously requires a <code>.Resolve()</code> first</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
</ul> </ul>
</div> </div>
</div> </div>
@@ -666,7 +721,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
</div> </div>
<div id="footer"> <div id="footer">
<div id="footer-text"> <div id="footer-text">
Last updated 2025-08-28 01:25:25 -0400 Last updated 2025-09-30 15:47:24 -0400
</div> </div>
</div> </div>
</body> </body>

View File

@@ -3,7 +3,7 @@
In addition to the documentation found in this document and [the In addition to the documentation found in this document and [the
specification](https://wireproto.io/), library usage documentation can specification](https://wireproto.io/), library usage documentation can
be found at [the Golang module documentation be found at [the Golang module documentation
page](https://pkg.go.dev/go.pkg.dev/r00t2.io/WireProto): page](https://pkg.go.dev/r00t2.io/wireproto):
# License # License
@@ -51,3 +51,56 @@ versions.
- This is a relatively low priority as the passed `net.Conn` will - This is a relatively low priority as the passed `net.Conn` will
likely return an error if its own context is canceled. This can likely return an error if its own context is canceled. This can
be handled in the caller downstream. be handled in the caller downstream.
- Better/more strict interfaces
- Maps for generic should have `any`, not `interface{}` values
- FVP should have its own method to a map\[string\]\[\]byte return
value
- "Getters and Setters" (ew, I know, but compromises are made with
flexibility)
- `.Append*()` methods to append any type to any parent type. e.g.
`<Response>.AppendFVP(<FieldValuePair>)` would append an FVP to
the most recent ResponseRecord to the most recent
ResponseRecordGroup (or create if they dont exist),
`<Response>.AppendRecord(…​)` for appending a record to most
recent record group etc.
- `.Get()`/`.Set()` on a Response/Request to get/set a slice of
values (`<FieldValue>`) from filter criteria as struct (e.g.
field name, how many, first X, last X, etc.)
- `.GetPath*()` and `.SetPath*()` to use
**\[`RG_N`\[`R_N`\[`FVP_N`\]\]\]** indexing (e.g. `0, 0, 0` for
RecordGroup 0/Record 0/FVP 0, `1, 3, 5` for RecordGroup 1/Record
3/FVP 5, etc.) multidimentional indexing
- Allow specific lookups/sets by multidimentional array index
to return FVP (`.GetIndex(idx)` where `idx` is a fixed-size
array of dimensions for objects children paths); e.g.
`<Response>.GetIndex(idx)`, `idx` is `[3]int` and returns
FVP)
- Allow lookups/sets by variable length index
(`.GetIndexDynamic(idx)`, where `idx` is a `1` to `n`-size
slice of dimensions for objects children paths (e.g.
`<Response>.GetIndexDynamic([]int{0, 0})` returns
`any(<Record>)` but
`<Response>.GetIndexDynamic([]int{0, 0, 0})` returns
`any(FieldValuePair)`)
- negative value indicates **all** children
- Lookups/sets at fixed levels (e.g.
`<RecordGroup>.GetRecord(idx)`, `idx` is `[1]int`, but
`<RecordGroup>.GetFVP(idx)`, `idx` is `[2]int`) for type
safety
- All objects have `.ID()` that returns their
index/"path"/"key" from the root, and `.Index()` that
returns their index within their immediate parent
- This obviously requires a `.Resolve()` first

View File

@@ -92,7 +92,15 @@ func ReadConnResponse(conn net.Conn) (resp *Response, err error) {
var size int var size int
var buf *bytes.Buffer = new(bytes.Buffer) var buf *bytes.Buffer = new(bytes.Buffer)
// First get the checksum. // Buffer in the status byte...
b = make([]byte, 1)
if _, err = conn.Read(b); err != nil {
return
}
if _, err = buf.Write(b); err != nil {
return
}
// Then get the checksum. Per spec, *all* responses *must* have a checksum.
b = make([]byte, len(hdrCKSUM)) b = make([]byte, len(hdrCKSUM))
if _, err = conn.Read(b); err != nil { if _, err = conn.Read(b); err != nil {
return return