Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DagsCmd = &cli.Command{ Name: "dags", Usage: "Get all piece details for generated dags", ArgsUsage: "<source_id>", Action: func(c *cli.Context) error { db, closer, err := database.OpenFromCLI(c) if err != nil { return err } defer closer.Close() cars, err := inspect.GetDagsHandler( c.Context, db, c.Args().Get(0), ) if err != nil { return err } cliutil.PrintToConsole(cars, c.Bool("json"), nil) return nil }, }
View Source
var FileDetailCmd = &cli.Command{ Name: "filedetail", Usage: "Get details about a specific file", ArgsUsage: "<file_id>", Action: func(c *cli.Context) error { db, closer, err := database.OpenFromCLI(c) if err != nil { return err } defer closer.Close() result, err := inspect.GetSourceFileDetailHandler( c.Context, db, c.Args().Get(0), ) if err != nil { return err } if c.Bool("json") { cliutil.PrintToConsole(result, true, nil) return nil } fmt.Println("File:") cliutil.PrintToConsole(result, false, nil) fmt.Println("File Parts:") cliutil.PrintToConsole(result.FileRanges, false, nil) return nil }, }
View Source
var FilesCmd = &cli.Command{ Name: "files", Usage: "Get all file details of a data source", ArgsUsage: "<source_id>", Description: "This command will list all files in a data source. This may be very large list.", Action: func(c *cli.Context) error { db, closer, err := database.OpenFromCLI(c) if err != nil { return err } defer closer.Close() result, err := inspect.GetSourceFilesHandler( c.Context, db, c.Args().Get(0), ) if err != nil { return err } cliutil.PrintToConsole(result, c.Bool("json"), nil) return nil }, }
View Source
var PackJobDetailCmd = &cli.Command{ Name: "packjobdetail", Usage: "Get details about a specific pack job", ArgsUsage: "<pack_job_id>", Action: func(c *cli.Context) error { db, closer, err := database.OpenFromCLI(c) if err != nil { return err } defer closer.Close() result, err := inspect.GetSourcePackJobDetailHandler( c.Context, db, c.Args().Get(0), ) if err != nil { return err } if c.Bool("json") { cliutil.PrintToConsole(result, true, nil) return nil } fmt.Println("Pack jobs:") cliutil.PrintToConsole(result, false, []string{"PackingWorkerID"}) fmt.Println("Pieces:") cliutil.PrintToConsole(result.Cars, false, nil) fmt.Println("File Parts:") cliutil.PrintToConsole(underscore.Map(result.FileRanges, func(i model.FileRange) FileRangeDetail { return FileRangeDetail{ ID: i.ID, FileID: i.FileID, Offset: i.Offset, Length: i.Length, FileRangeCid: i.CID, SourceID: i.File.SourceID, Path: i.File.Path, Hash: i.File.Hash, Size: i.File.Size, LastModifiedTimestampNano: i.File.LastModifiedTimestampNano, FileCID: i.File.CID, DirectoryID: *i.File.DirectoryID, } }), false, nil) return nil }, }
View Source
var PackJobsCmd = &cli.Command{ Name: "packjobs", Usage: "Get all pack job details of a data source", ArgsUsage: "<source_id>", Flags: []cli.Flag{ &cli.GenericFlag{ Name: "state", Value: new(model.WorkState), Usage: "Filter pack jobs by state. Valid values are: " + strings.Join(model.WorkStateStrings, ", "), Aliases: []string{"s"}, DefaultText: "All states", }, }, Action: func(c *cli.Context) error { db, closer, err := database.OpenFromCLI(c) if err != nil { return err } defer closer.Close() sourceID, err := strconv.ParseUint(c.Args().Get(0), 10, 32) if err != nil { return err } result, err := inspect.GetSourcePackJobsHandler( c.Context, db, uint32(sourceID), inspect.GetSourcePackJobsRequest{State: *(c.Generic("state").(*model.WorkState))}, ) if err != nil { return err } if c.Bool("json") { cliutil.PrintToConsole(result, true, nil) return nil } fmt.Println("Pack jobs:") cliutil.PrintToConsole(result, false, []string{"PackingWorkerID"}) return nil }, }
View Source
var PathCmd = &cli.Command{ Name: "path", Usage: "Get details about a path within a data source", ArgsUsage: "<source_id> <path>", Action: func(c *cli.Context) error { db, closer, err := database.OpenFromCLI(c) if err != nil { return err } defer closer.Close() result, err := inspect.GetPathHandler( c.Context, db, c.Args().Get(0), inspect.GetPathRequest{ Path: c.Args().Get(1), }, ) if err != nil { return err } if c.Bool("json") { cliutil.PrintToConsole(result, true, nil) return nil } fmt.Println("Current Directory:") cliutil.PrintToConsole(result.Current, false, nil) if len(result.Dirs) > 0 { fmt.Println("SubDirs:") cliutil.PrintToConsole(result.Dirs, false, nil) } if len(result.Files) > 0 { fmt.Println("SubFiles:") cliutil.PrintToConsole(result.Files, false, nil) } return nil }, }
Functions ¶
This section is empty.
Types ¶
type FileRangeDetail ¶ added in v0.3.0
type FileRangeDetail struct { ID uint64 `json:"id"` FileID uint64 `json:"fileId"` Offset int64 `json:"offset"` Length int64 `json:"length"` FileRangeCid model.CID `json:"fileRangeCid"` SourceID uint32 `json:"sourceId"` Path string `json:"path"` Hash string `json:"hash"` Size int64 `json:"size"` LastModifiedTimestampNano int64 `json:"lastModified"` FileCID model.CID `json:"fileCid"` DirectoryID uint64 `json:"directoryId"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.