Documentation
¶
Overview ¶
Package siteexport extracts a single site from a full UniFi backup and repackages it as an importable .unf site export.
A UniFi MongoDB dump is a command stream: a document {__cmd:"select", collection:"X"} selects a collection, and the documents that follow are its rows until the next select. Per-site collections carry a site_id string that references the owning site's _id. Exporting a site means emitting that site's row plus, for each per-site collection, only the rows whose site_id matches.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parsed ¶
type Parsed struct {
Sites []Site
// contains filtered or unexported fields
}
Parsed is the decoded command stream of a full backup's MongoDB dump.
func Parse ¶
Parse decodes a decompressed MongoDB dump (the raw concatenated-BSON stream) into its sites and per-collection rows.
func (*Parsed) BuildUnf ¶
func (p *Parsed) BuildUnf(site Site, version string, timestampMillis int64, extras []Extra) ([]byte, error)
BuildUnf assembles and encrypts an importable .unf for the given site. version is the source controller version; timestampMillis stamps the export; extras are site-scoped files already remapped to "sites/<name>/..." paths.