content

package
v0.0.0-...-cdc83d6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ZasperActiveWatcherConnections map[string]*ContentWatchConnection

Functions

func ContentAPIHandler

func ContentAPIHandler(w http.ResponseWriter, req *http.Request)

func ContentCreateAPIHandler

func ContentCreateAPIHandler(w http.ResponseWriter, req *http.Request)

func ContentDeleteAPIHandler

func ContentDeleteAPIHandler(w http.ResponseWriter, req *http.Request)

func ContentRenameAPIHandler

func ContentRenameAPIHandler(w http.ResponseWriter, req *http.Request)

func ContentUpdateAPIHandler

func ContentUpdateAPIHandler(w http.ResponseWriter, req *http.Request)

func CreateDirectory

func CreateDirectory(payload ContentPayload) models.ContentModel

func GetContent

func GetContent(relativePath string, contentType string, format string, hash int) models.ContentModel

func GetKernelPath

func GetKernelPath(path string) int

func GetOSPath

func GetOSPath(path string) string

func HandleWatchWebSocket

func HandleWatchWebSocket(w http.ResponseWriter, req *http.Request)

HandleWatchWebSocket handles WebSocket connections and manages the lifecycle of a terminal session.

func IsDir

func IsDir(path string) bool

func NewErrorResponse

func NewErrorResponse(w http.ResponseWriter, i int, s string)

func SetUpActiveWatcherConnections

func SetUpActiveWatcherConnections() map[string]*ContentWatchConnection

func UpdateContent

func UpdateContent(path, ftype, format, content string) error

func UpdateNbContent

func UpdateNbContent(path, ftype, format string, content interface{}) error

Types

type Cell

type Cell struct {
	Source         string                 `json:"source"`
	ExecutionCount int                    `json:"execution_count"`
	CellType       string                 `json:"cell_type"`
	Attachments    map[string]string      `json:"attachments"`
	Outputs        []Output               `json:"outputs"`
	Metadata       map[string]interface{} `json:"metadata"`
}

type CellDisk

type CellDisk struct {
	Source         []string               `json:"source"`
	ExecutionCount int                    `json:"execution_count"`
	CellType       string                 `json:"cell_type"`
	Attachments    map[string]interface{} `json:"attachments"`
	Outputs        []OutputDisk           `json:"outputs"`
	Metadata       map[string]interface{} `json:"metadata"`
}

Cell struct for handling individual cells in a notebook

type ContentPayload

type ContentPayload struct {
	ContentType string `json:"type"`
	ParentDir   string `json:"parent_dir"`
}

type ContentRequestBody

type ContentRequestBody struct {
	Path   string `json:"path"`
	Type   string `json:"type"`
	Hash   string `json:"hash"`
	Format string `json:"format"`
}

type ContentUpdateRequest

type ContentUpdateRequest struct {
	Path    string      `json:"path"`
	Content interface{} `json:"content"`
	Format  string      `json:"format"`
	Type    string      `json:"type"`
}

type ContentWatchConnection

type ContentWatchConnection struct {
	Conn          *websocket.Conn
	Send          chan []byte
	KernelId      string
	Context       context.Context
	PollingCancel context.CancelFunc
	// contains filtered or unexported fields
}

type Notebook

type Notebook struct {
	Cells    []Cell                 `json:"cells"`
	Metadata map[string]interface{} `json:"metadata"`
}

Notebook struct that is rendered as json to outside world

type NotebookDisk

type NotebookDisk struct {
	Cells    []CellDisk             `json:"cells"`
	Metadata map[string]interface{} `json:"metadata"`
}

Notebook struct to be stored on disk

type Output

type Output struct {
	OutputType     string                 `json:"output_type"`
	ExecutionCount int                    `json:"execution_count"`
	Data           map[string]string      `json:"data"`
	Text           string                 `json:"text"`
	Metadata       map[string]interface{} `json:"metadata"`
	// in case of error traceback
	Ename     string   `json:"ename"`
	Evalue    string   `json:"evalue"`
	Traceback []string `json:"traceback"`
}

type OutputDisk

type OutputDisk struct {
	OutputType     string                 `json:"output_type"`
	ExecutionCount int                    `json:"execution_count"`
	Data           map[string]interface{} `json:"data"`
	Text           []string               `json:"text"`
	Metadata       map[string]interface{} `json:"metadata"`
	// in case of error traceback
	Ename     string   `json:"ename"`
	Evalue    string   `json:"evalue"`
	Traceback []string `json:"traceback"`
}

Output struct for handling cell outputs

type RenameContentPayload

type RenameContentPayload struct {
	ParentDir string `json:"parent_dir"`
	OldName   string `json:"old_name"`
	NewName   string `json:"new_name"`
}

Jump to

Keyboard shortcuts

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