Skip to content

Commit ccbc273

Browse files
committed
update README
1 parent 3c053e1 commit ccbc273

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Readers can access the table always lock-free, while writers may synchronize usi
5959
that only one writer can modify the table persistent at a time, not using Compare-and-Swap (CAS)
6060
with all the known problems for multiple long-running writers.
6161

62-
The combination of lock-free concurrency, fast lookup times, low memory usage, and
63-
internal data structure pooling should offer significant benefits to any routing daemon.
62+
The combination of lock-free concurrency, fast lookup and update times, low memory consumption,
63+
and optional internal data structure pooling provides clear advantages for any routing daemon.
6464

6565
But as always, it depends on the specific use case.
6666

@@ -77,15 +77,16 @@ are used.
7777
type Table[V any] struct {
7878
// Has unexported fields.
7979
}
80-
// Table is an IPv4 and IPv6 routing table with payload V. The zero value is
81-
// ready to use.
82-
83-
// The Table is safe for concurrent readers but not for concurrent readers
84-
// and/or writers. Either the update operations must be protected by an
85-
// external lock mechanism or the various ...Persist functions must be used
86-
// which return a modified routing table by leaving the original unchanged
87-
88-
// A Table must not be copied by value.
80+
// Table represents a thread-safe IPv4 and IPv6 routing table with payload V.
81+
//
82+
// The zero value is ready to use.
83+
//
84+
// The Table is safe for concurrent reads, but concurrent reads and writes
85+
// must be externally synchronized. Mutation via Insert/Delete requires locks,
86+
// or alternatively, use ...Persist methods which return a modified copy
87+
// without altering the original table (copy-on-write).
88+
//
89+
// A Table must not be copied by value; always pass by pointer.
8990

9091
func (t *Table[V]) WithPool() *Table[V]
9192

@@ -142,17 +143,18 @@ are used.
142143

143144
A `bart.Lite` wrapper is also included, this is ideal for simple IP
144145
ACLs (access-control-lists) with plain true/false results and no payload.
145-
Lite is just a convenience wrapper for Table, instantiated with an empty
146-
struct as payload.
147146

148-
Lite wraps or adapts some methods where needed or delegates almost all
147+
Lite wraps or adapts some methods where needed and delegates almost all
149148
other methods unmodified to the underlying Table.
150149
Some delegated methods are pointless without a payload.
151150

152151
```golang
153152
type Lite struct {
154153
Table[struct{}]
155154
}
155+
// Lite is just a convenience wrapper for Table, instantiated with an
156+
// empty struct as payload. Lite is ideal for simple IP ACLs
157+
// (access-control-lists) with plain true/false results without a payload.
156158

157159
func (l *Lite) WithPool() *Lite
158160

0 commit comments

Comments
 (0)