Documentation
¶
Index ¶
- Constants
- Variables
- func LoginPollSecretHash(secret string) string
- func NewLoginPollSecret() (string, error)
- func SQLiteBundleManifestKey(app, archive string) string
- func SQLiteBundlePartKey(app, archive string, index int) string
- func SQLiteCompressedObjectKey(app, archive string) string
- func SQLiteObjectKey(app, archive string) string
- type AppSpec
- type Archive
- type AuthConfig
- type AuthSpec
- type ChainTokenProvider
- type Client
- func (c *Client) Archives(ctx context.Context) ([]Archive, error)
- func (c *Client) BatchRead(ctx context.Context, app, archive string, requests []QueryRequest) ([]QueryResult, error)
- func (c *Client) Contract(ctx context.Context) (Contract, error)
- func (c *Client) Ingest(ctx context.Context, app, archive string, req IngestRequest) (IngestResult, error)
- func (c *Client) LoginWithGitHubToken(ctx context.Context, token string) (LoginPollResult, error)
- func (c *Client) PollGitHubLogin(ctx context.Context, loginID, pollSecret string) (LoginPollResult, error)
- func (c *Client) Query(ctx context.Context, app, archive string, req QueryRequest) (QueryResult, error)
- func (c *Client) StartGitHubLogin(ctx context.Context, pollSecretHash string) (LoginStartResult, error)
- func (c *Client) Status(ctx context.Context, app, archive string) (Status, error)
- func (c *Client) UploadSQLite(ctx context.Context, app, archive string, upload SQLiteUploadRequest) (SQLiteUploadResult, error)
- func (c *Client) UploadSQLiteBundleFiles(ctx context.Context, app, archive string, manifest SQLiteBundleManifest, ...) (SQLiteBundleUploadResult, error)
- func (c *Client) UploadSQLiteBundleManifest(ctx context.Context, app, archive string, manifest SQLiteBundleManifest) (SQLiteBundleUploadResult, error)
- func (c *Client) UploadSQLiteBundlePart(ctx context.Context, app, archive string, part SQLiteBundlePartUpload) (SQLiteUploadResult, error)
- func (c *Client) Whoami(ctx context.Context) (Identity, error)
- type Config
- type Contract
- type EnvTokenProvider
- type Error
- type GitHubTokenLoginRequest
- type Identity
- type IngestManifest
- type IngestRequest
- type IngestResult
- type IngestTableSpec
- type LoginPollRequest
- type LoginPollResult
- type LoginStartRequest
- type LoginStartResult
- type Options
- type QueryRequest
- type QueryResult
- type QuerySpec
- type QueryStats
- type RouteSpec
- type SQLiteBundle
- type SQLiteBundleBuild
- type SQLiteBundleBuildOptions
- type SQLiteBundleCompression
- type SQLiteBundleManifest
- type SQLiteBundleObject
- type SQLiteBundlePart
- type SQLiteBundlePartFile
- type SQLiteBundlePartUpload
- type SQLiteBundleUploadResult
- type SQLiteObject
- type SQLiteUploadRequest
- type SQLiteUploadResult
- type StaticToken
- type Status
- type TokenProvider
Constants ¶
View Source
const ( ProtocolVersion = "v1" ContractPath = "/v1/contract" HealthPath = "/health" AuthPublic = "public" AuthReader = "reader" AuthPublisher = "publisher" )
View Source
const ( ModeLocal = "local" ModeGit = "git" ModeCloud = "cloud" ModeHybrid = "hybrid" ModePublisher = "publisher" DefaultTokenEnv = "CRAWL_REMOTE_TOKEN" )
View Source
const ( SQLiteGzipChunkedBundleFormat = "sqlite-gzip-chunked-v1" SQLiteGzipCompression = "gzip" DefaultSQLiteBundleChunkSize = int64(256 * 1024 * 1024) )
Variables ¶
View Source
var ErrMissingToken = errors.New("remote token is missing")
Functions ¶
func LoginPollSecretHash ¶
func NewLoginPollSecret ¶
func SQLiteBundleManifestKey ¶ added in v0.11.0
func SQLiteBundlePartKey ¶ added in v0.11.0
func SQLiteCompressedObjectKey ¶ added in v0.11.0
func SQLiteObjectKey ¶ added in v0.11.0
Types ¶
type AppSpec ¶ added in v0.10.0
type AppSpec struct {
App string `json:"app"`
Queries []QuerySpec `json:"queries,omitempty"`
IngestTables []IngestTableSpec `json:"ingest_tables,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
}
type Archive ¶
type Archive struct {
ID string `json:"id"`
App string `json:"app"`
Slug string `json:"slug"`
SchemaName string `json:"schema_name,omitempty"`
SchemaVersion int `json:"schema_version,omitempty"`
SchemaHash string `json:"schema_hash,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
LastIngestAt string `json:"last_ingest_at,omitempty"`
LastSyncAt string `json:"last_sync_at,omitempty"`
}
type AuthConfig ¶
type ChainTokenProvider ¶
type ChainTokenProvider []TokenProvider
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BatchRead ¶
func (c *Client) BatchRead(ctx context.Context, app, archive string, requests []QueryRequest) ([]QueryResult, error)
func (*Client) Ingest ¶
func (c *Client) Ingest(ctx context.Context, app, archive string, req IngestRequest) (IngestResult, error)
func (*Client) LoginWithGitHubToken ¶
func (*Client) PollGitHubLogin ¶
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, app, archive string, req QueryRequest) (QueryResult, error)
func (*Client) StartGitHubLogin ¶
func (*Client) UploadSQLite ¶ added in v0.10.0
func (c *Client) UploadSQLite(ctx context.Context, app, archive string, upload SQLiteUploadRequest) (SQLiteUploadResult, error)
func (*Client) UploadSQLiteBundleFiles ¶ added in v0.11.0
func (c *Client) UploadSQLiteBundleFiles(ctx context.Context, app, archive string, manifest SQLiteBundleManifest, parts []SQLiteBundlePartFile) (SQLiteBundleUploadResult, error)
func (*Client) UploadSQLiteBundleManifest ¶ added in v0.11.0
func (c *Client) UploadSQLiteBundleManifest(ctx context.Context, app, archive string, manifest SQLiteBundleManifest) (SQLiteBundleUploadResult, error)
func (*Client) UploadSQLiteBundlePart ¶ added in v0.11.0
func (c *Client) UploadSQLiteBundlePart(ctx context.Context, app, archive string, part SQLiteBundlePartUpload) (SQLiteUploadResult, error)
type Config ¶
type Config struct {
Mode string `toml:"mode" json:"mode"`
Endpoint string `toml:"endpoint" json:"endpoint"`
Archive string `toml:"archive" json:"archive"`
TokenEnv string `toml:"token_env" json:"token_env"`
StaleAfter string `toml:"stale_after" json:"stale_after"`
Auth AuthConfig `toml:"auth" json:"auth"`
}
type Contract ¶ added in v0.10.0
type Contract struct {
ProtocolVersion string `json:"protocol_version"`
Service string `json:"service,omitempty"`
Routes []RouteSpec `json:"routes"`
Apps []AppSpec `json:"apps"`
Auth []AuthSpec `json:"auth,omitempty"`
Notes []string `json:"notes,omitempty"`
}
func BaseContract ¶ added in v0.10.0
func BaseContract() Contract
type EnvTokenProvider ¶
type EnvTokenProvider struct {
Name string
}
type Error ¶
type GitHubTokenLoginRequest ¶
type GitHubTokenLoginRequest struct {
Token string `json:"token"`
}
type IngestManifest ¶
type IngestManifest struct {
App string `json:"app"`
Archive string `json:"archive"`
SchemaName string `json:"schema_name,omitempty"`
SchemaVersion int `json:"schema_version"`
SchemaHash string `json:"schema_hash"`
Mode string `json:"mode,omitempty"`
Source string `json:"source,omitempty"`
SourceSyncAt string `json:"source_sync_at,omitempty"`
}
type IngestRequest ¶
type IngestResult ¶
type IngestTableSpec ¶ added in v0.10.0
type LoginPollRequest ¶
type LoginPollResult ¶
type LoginStartRequest ¶
type LoginStartRequest struct {
PollSecretHash string `json:"pollSecretHash"`
}
type LoginStartResult ¶
type Options ¶
type Options struct {
Endpoint string
HTTPClient *http.Client
TokenProvider TokenProvider
UserAgent string
}
type QueryRequest ¶
type QueryResult ¶
type QueryStats ¶
type SQLiteBundle ¶ added in v0.11.0
type SQLiteBundleBuild ¶ added in v0.11.0
type SQLiteBundleBuild struct {
Manifest SQLiteBundleManifest
CompressedPath string
Parts []SQLiteBundlePartFile
Cleanup func()
}
func BuildGzipSQLiteBundle ¶ added in v0.11.0
func BuildGzipSQLiteBundle(ctx context.Context, opts SQLiteBundleBuildOptions) (SQLiteBundleBuild, error)
type SQLiteBundleBuildOptions ¶ added in v0.11.0
type SQLiteBundleCompression ¶ added in v0.11.0
type SQLiteBundleCompression struct {
Algorithm string `json:"algorithm,omitempty"`
}
type SQLiteBundleManifest ¶ added in v0.11.0
type SQLiteBundleManifest struct {
Format string `json:"format"`
App string `json:"app"`
Archive string `json:"archive"`
GeneratedAt string `json:"generated_at,omitempty"`
ContentType string `json:"content_type,omitempty"`
Compression SQLiteBundleCompression `json:"compression,omitempty"`
Privacy map[string]any `json:"privacy,omitempty"`
Object SQLiteBundleObject `json:"object"`
CompressedObject SQLiteBundleObject `json:"compressed_object"`
Reconstruct string `json:"reconstruct,omitempty"`
Counts map[string]int64 `json:"counts,omitempty"`
Parts []SQLiteBundlePart `json:"parts"`
}
type SQLiteBundleObject ¶ added in v0.11.0
type SQLiteBundlePart ¶ added in v0.11.0
type SQLiteBundlePartFile ¶ added in v0.11.0
type SQLiteBundlePartFile struct {
SQLiteBundlePart
Path string
}
type SQLiteBundlePartUpload ¶ added in v0.11.0
type SQLiteBundleUploadResult ¶ added in v0.11.0
type SQLiteBundleUploadResult struct {
App string `json:"app,omitempty"`
Archive string `json:"archive,omitempty"`
Complete bool `json:"complete,omitempty"`
Bundle *SQLiteBundle `json:"bundle,omitempty"`
}
type SQLiteObject ¶ added in v0.10.0
type SQLiteUploadRequest ¶ added in v0.10.0
type SQLiteUploadResult ¶ added in v0.10.0
type SQLiteUploadResult struct {
App string `json:"app,omitempty"`
Archive string `json:"archive,omitempty"`
Complete bool `json:"complete,omitempty"`
Object *SQLiteObject `json:"object,omitempty"`
}
type StaticToken ¶
type StaticToken string
type Status ¶
type Status struct {
App string `json:"app"`
Archive string `json:"archive"`
Mode string `json:"mode,omitempty"`
GeneratedAt string `json:"generated_at,omitempty"`
LastSyncAt string `json:"last_sync_at,omitempty"`
LastIngestAt string `json:"last_ingest_at,omitempty"`
Counts []control.Count `json:"counts,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
SQLiteObject *SQLiteObject `json:"sqlite_object,omitempty"`
SQLiteBundle *SQLiteBundle `json:"sqlite_bundle,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.