storageTable

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(ctx *cli.Context, storage *structureSpec.Storage, prompt string) bool

func List

func List(storages []*structureSpec.Storage)
Example
package main

import (
	structureSpec "github.com/taubyte/go-specs/structure"
	storageTable "github.com/taubyte/tau-cli/table/storage"
)

func main() {
	storages := []*structureSpec.Storage{
		{
			Id:    "QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH",
			Name:  "someStorage1",
			Match: "/test/v1",
		},
		{
			Id:    "QmbUIDhRosp5BaXDASEWSCtpkQCgQCPdRVhnxjiSHfXdC0",
			Name:  "someStorage2",
			Match: "/test/v2",
		},
	}

	storageTable.List(storages)

}
Output:

┌─────────────────┬──────────────┬──────────┐
│ ID              │ NAME         │ MATCH    │
├─────────────────┼──────────────┼──────────┤
│ QmbAA8...HfXdWH │ someStorage1 │ /test/v1 │
├─────────────────┼──────────────┼──────────┤
│ QmbUID...HfXdC0 │ someStorage2 │ /test/v2 │
└─────────────────┴──────────────┴──────────┘

func Query

func Query(storage *structureSpec.Storage)
Example (Object)
package main

import (
	"github.com/alecthomas/units"
	structureSpec "github.com/taubyte/go-specs/structure"

	storageTable "github.com/taubyte/tau-cli/table/storage"
)

func main() {
	storage := &structureSpec.Storage{
		Id:          "QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH",
		Name:        "someProject",
		Description: "this is a storage of some type",
		Tags:        []string{"apple", "orange", "banana"},
		Match:       "/test/v1",
		Regex:       false,
		Type:        "Object",
		Public:      false,
		Size:        uint64(39 * units.MB),
		Versioning:  false,
	}

	storageTable.Query(storage)

}
Output:

┌────────────────┬────────────────────────────────────────────────┐
│ ID             │ QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH │
├────────────────┼────────────────────────────────────────────────┤
│ Name           │ someProject                                    │
├────────────────┼────────────────────────────────────────────────┤
│ Description    │ this is a storage of some type                 │
├────────────────┼────────────────────────────────────────────────┤
│ Tags           │ apple, orange, banana                          │
├────────────────┼────────────────────────────────────────────────┤
│ Access         │                                                │
├────────────────┼────────────────────────────────────────────────┤
│  -  Network    │ host                                           │
├────────────────┼────────────────────────────────────────────────┤
│ Object         │                                                │
├────────────────┼────────────────────────────────────────────────┤
│  -  Versioning │ false                                          │
├────────────────┼────────────────────────────────────────────────┤
│  -  Size       │ 39MB                                           │
└────────────────┴────────────────────────────────────────────────┘
Example (Streaming)
package main

import (
	"github.com/alecthomas/units"
	structureSpec "github.com/taubyte/go-specs/structure"

	storageTable "github.com/taubyte/tau-cli/table/storage"
)

func main() {
	storage := &structureSpec.Storage{
		Id:          "QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH",
		Name:        "someProject",
		Description: "this is a storage of some type",
		Tags:        []string{"apple", "orange", "banana"},
		Match:       "/test/v1",
		Regex:       false,
		Type:        "Streaming",
		Public:      true,
		Size:        uint64(4 * units.MB),
		Ttl:         50000,
	}

	storageTable.Query(storage)

}
Output:

┌─────────────┬────────────────────────────────────────────────┐
│ ID          │ QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH │
├─────────────┼────────────────────────────────────────────────┤
│ Name        │ someProject                                    │
├─────────────┼────────────────────────────────────────────────┤
│ Description │ this is a storage of some type                 │
├─────────────┼────────────────────────────────────────────────┤
│ Tags        │ apple, orange, banana                          │
├─────────────┼────────────────────────────────────────────────┤
│ Access      │                                                │
├─────────────┼────────────────────────────────────────────────┤
│  -  Network │ all                                            │
├─────────────┼────────────────────────────────────────────────┤
│ Streaming   │                                                │
├─────────────┼────────────────────────────────────────────────┤
│  -  TTL     │ 50µs                                           │
├─────────────┼────────────────────────────────────────────────┤
│  -  Size    │ 4MB                                            │
└─────────────┴────────────────────────────────────────────────┘

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL