Skip to content

Commit 15e3af2

Browse files
committed
chore: tidy up heading structures
1 parent e8f760c commit 15e3af2

File tree

2 files changed

+135
-78
lines changed

2 files changed

+135
-78
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,20 @@ go get github.com/trufnetwork/sdk-go
2525
### Setting Up a Local Node
2626

2727
1. **Prerequisites:**
28+
2829
- Docker
2930
- Docker Compose
3031
- Git
3132

3233
2. **Clone the TN Node Repository:**
34+
3335
```bash
3436
git clone https://github.com/trufnetwork/node.git
3537
cd node
3638
```
3739

3840
3. **Start the Local Node:**
41+
3942
```bash
4043
# Start the node in development mode
4144
task single:start
@@ -120,8 +123,8 @@ func main() {
120123
// Display retrieved records
121124
fmt.Println("AI Index Records from Local Node:")
122125
for _, record := range records {
123-
fmt.Printf("Event Time: %d, Value: %s\n",
124-
record.EventTime,
126+
fmt.Printf("Event Time: %d, Value: %s\n",
127+
record.EventTime,
125128
record.Value.String(),
126129
)
127130
}
@@ -184,7 +187,7 @@ func main() {
184187

185188
- **Primitive Streams**: Direct data sources from providers. Examples include indexes from known sources, aggregation output such as sentiment analysis, and off-chain/on-chain data.
186189
- **Composed Streams**: Aggregate and process data from multiple streams.
187-
- **System Streams**: Contract-managed streams audited and accepted by TN governance to ensure quality.
190+
- **System Streams**: Contract-managed streams audited and accepted by TN governance to ensure quality.
188191

189192
See [type of streams](./docs/type-of-streams.md) and [default TN contracts](./docs/contracts.md) guides for more information.
190193

@@ -231,7 +234,7 @@ The SDK-Go repository is licensed under the Apache License, Version 2.0. See [LI
231234

232235
## Stream Creation and Management
233236

234-
The TN SDK provides comprehensive support for creating and managing both primitive and composed streams.
237+
The TN SDK provides comprehensive support for creating and managing both primitive and composed streams.
235238

236239
### Primitive Streams
237240

@@ -295,6 +298,7 @@ For a comprehensive example demonstrating stream creation, taxonomy setup, and d
295298
- Retrieving composed stream records
296299

297300
Key steps include:
301+
298302
1. Generating unique stream IDs
299303
2. Deploying primitive and composed streams
300304
3. Inserting records into primitive streams
@@ -308,14 +312,17 @@ This example provides a practical walkthrough of creating and managing streams i
308312
#### Stream Locators
309313

310314
A `StreamLocator` is a unique identifier for a stream that consists of two key components:
315+
311316
1. `StreamId`: A unique identifier for the stream
312317
2. `DataProvider`: The Ethereum address of the stream's creator/owner
313318

314319
The `OwnStreamLocator()` method is a convenience function that automatically creates a `StreamLocator` using:
320+
315321
- The provided `StreamId`
316322
- The current client's Ethereum address
317323

318324
Example:
325+
319326
```go
320327
// Creates a StreamLocator with:
321328
// - The given stream ID
@@ -330,6 +337,7 @@ This is particularly useful when you're creating and managing your own streams,
330337
A `DataProvider` is the Ethereum address responsible for creating and managing a stream. When inserting records or performing operations on a stream, you need to specify the data provider's address.
331338

332339
To get the current client's address, use:
340+
333341
```go
334342
// Get the current client's Ethereum address
335343
dataProviderAddress := tnClient.Address()
@@ -339,6 +347,7 @@ dataProviderAddressString := dataProviderAddress.Address()
339347
```
340348

341349
Key differences:
350+
342351
- `tnClient.Address()` returns an `EthereumAddress` object
343352
- `dataProviderAddress.Address()` returns the address as a string, which is used in stream operations
344353

@@ -369,6 +378,7 @@ insertTx, err := primitiveActions.InsertRecords(ctx, []types.InsertRecordInput{
369378
```
370379

371380
This approach ensures that:
381+
372382
- Streams are uniquely identified
373383
- Records are correctly attributed to their creator
374384
- Stream operations are performed with the correct addressing
@@ -378,6 +388,7 @@ This approach ensures that:
378388
#### Why Delete Streams?
379389

380390
Stream deletion is crucial for:
391+
381392
- Cleaning up unused or test streams
382393
- Managing resource consumption
383394
- Maintaining a clean and organized stream ecosystem
@@ -404,10 +415,12 @@ if err != nil {
404415
#### Best Practices for Stream Deletion
405416

406417
1. **Cleanup in Reverse Order**
418+
407419
- Delete composed streams before their child primitive streams
408420
- Ensures proper resource management and prevents orphaned references
409421

410422
2. **Error Handling**
423+
411424
- Always check for errors during stream deletion
412425
- Log and handle potential issues gracefully
413426

@@ -416,6 +429,7 @@ if err != nil {
416429
- Ensures resources are freed even if an error occurs
417430

418431
Example of Deferred Stream Deletion:
432+
419433
```go
420434
func main() {
421435
// Defer stream destruction
@@ -461,3 +475,6 @@ func main() {
461475

462476
By following these guidelines, you can effectively manage stream resources in the TRUF.NETWORK ecosystem.
463477

478+
## Documentation
479+
480+
For more detailed information about stream management and the full SDK API, please refer to the [API Reference](docs/api-reference.md).

0 commit comments

Comments
 (0)