core

package
v0.0.0-...-90c1326 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ChunkSize = 1024 * 1024 * 5 // 5MB chunks

Variables

View Source
var (
	ErrCollectionNotFound = errors.New("collection not found")
)

Error definitions

Functions

This section is empty.

Types

type Collection

type Collection struct {
	ID       string                 `json:"id"`
	Name     string                 `json:"name"`
	Objects  []string               `json:"objects"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

Collection represents a group of related objects

type ModelChunk

type ModelChunk struct {
	ID      string `json:"id"`
	Data    []byte `json:"data"`
	Index   int    `json:"index"`
	ModelID string `json:"model_id"`
	Hash    string `json:"hash"`
}

type ModelMetadata

type ModelMetadata struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Format      string    `json:"format"`
	Size        int64     `json:"size"`
	Hash        string    `json:"hash"`
	Chunks      []string  `json:"chunks"`
	CreatedAt   time.Time `json:"created_at"`
	Owner       string    `json:"owner"`
	Permissions []string  `json:"permissions"`
}

func (*ModelMetadata) CalculateHash

func (m *ModelMetadata) CalculateHash() string

type ModelSummary

type ModelSummary struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Size      int64     `json:"size"`
	CreatedAt time.Time `json:"created_at"`
}

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(cfg *config.Config) (*Node, error)

func (*Node) Start

func (n *Node) Start(ctx context.Context) error

func (*Node) Stop

func (n *Node) Stop() error

type Object

type Object struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Format      string    `json:"format"`
	Size        int64     `json:"size"`
	BlockHashes []string  `json:"blocks"`
	Materials   []string  `json:"materials,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Object represents a 3D model object with its metadata and blocks

type ObjectService

type ObjectService struct {
	// contains filtered or unexported fields
}

ObjectService handles operations on 3D model objects

func NewObjectService

func NewObjectService(blockService *blocks.Service, storage *Storage) *ObjectService

NewObjectService creates a new object service instance

func (*ObjectService) CreateObject

func (s *ObjectService) CreateObject(ctx context.Context, name, format string, data []byte) (*Object, error)

CreateObject creates a new 3D model object

func (*ObjectService) DeleteObject

func (s *ObjectService) DeleteObject(ctx context.Context, id string) error

DeleteObject removes an object and its blocks

func (*ObjectService) GetObject

func (s *ObjectService) GetObject(ctx context.Context, id string) (*Object, error)

GetObject retrieves an object by ID

type Organizer

type Organizer struct {
	// contains filtered or unexported fields
}

Organizer manages object relationships and collections

func NewOrganizer

func NewOrganizer(referencer *Referencer) *Organizer

NewOrganizer creates a new organizer instance

func (*Organizer) AddToCollection

func (o *Organizer) AddToCollection(ctx context.Context, collectionID, objectID string) error

AddToCollection adds an object to a collection

func (*Organizer) CreateCollection

func (o *Organizer) CreateCollection(ctx context.Context, name string) (*Collection, error)

CreateCollection creates a new collection

func (*Organizer) GetCollection

func (o *Organizer) GetCollection(ctx context.Context, id string) (*Collection, error)

GetCollection retrieves a collection by ID

type Referencer

type Referencer struct {
	// contains filtered or unexported fields
}

Referencer manages references between objects and their dependencies

func NewReferencer

func NewReferencer() *Referencer

NewReferencer creates a new referencer instance

func (*Referencer) AddReference

func (r *Referencer) AddReference(ctx context.Context, fromID, toID string) error

AddReference adds a reference from one object to another

func (*Referencer) GetBackReferences

func (r *Referencer) GetBackReferences(ctx context.Context, objectID string) ([]string, error)

GetBackReferences returns all objects that reference the given object

func (*Referencer) GetReferences

func (r *Referencer) GetReferences(ctx context.Context, objectID string) ([]string, error)

GetReferences returns all objects referenced by the given object

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(path string) (*Storage, error)

func (*Storage) DeleteModel

func (s *Storage) DeleteModel(ctx context.Context, modelID string) error

func (*Storage) DeleteObject

func (s *Storage) DeleteObject(ctx context.Context, id string) error

DeleteObject removes an object's metadata

func (*Storage) GetModel

func (s *Storage) GetModel(ctx context.Context, modelID string) (*ModelMetadata, error)

GetModel retrieves a model's metadata by ID

func (*Storage) GetModelMetadata

func (s *Storage) GetModelMetadata(ctx context.Context, modelID string) (interface{}, error)

GetModelMetadata retrieves metadata for a specific model by ID

func (*Storage) GetObject

func (s *Storage) GetObject(ctx context.Context, id string) (*Object, error)

GetObject retrieves an object's metadata by ID

func (*Storage) GetStatus

func (s *Storage) GetStatus(ctx context.Context) (*StorageStatus, error)

GetStatus returns the current status of the storage system

func (*Storage) ListModels

func (s *Storage) ListModels(ctx context.Context) ([]ModelMetadata, error)

func (*Storage) StoreModel

func (s *Storage) StoreModel(ctx context.Context, name string, format string, reader io.Reader) (*ModelMetadata, error)

func (*Storage) StoreObject

func (s *Storage) StoreObject(ctx context.Context, obj *Object) error

StoreObject stores an object's metadata

func (*Storage) StreamModel

func (s *Storage) StreamModel(ctx context.Context, modelID string, writer io.Writer) error

StreamModel reads a model's chunks and streams them to the provided writer

type StorageStatus

type StorageStatus struct {
	TotalModels int            `json:"total_models"`
	TotalSize   int64          `json:"total_size"`
	BasePath    string         `json:"base_path"`
	Models      []ModelSummary `json:"models"`
}

StorageStatus represents the current state of the storage system

Jump to

Keyboard shortcuts

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