Documentation ¶
Index ¶
- func GetGarbageRemovalTime() (time.Time, url.Values)
- func IsDeviceValid(DeviceID primitive.ObjectID) (result bool, errs url.Values)
- func IsObjectGarbage(ObjectID string) (result bool, errs url.Values)
- func IsObjectValid(ObjectID string) (result bool, errs url.Values)
- func MergeErrors(errors url.Values, newErrors url.Values) url.Values
- func UnMarkObjectAsGarbage(ObjectID string) (result bool, errs url.Values)
- type DeleteDeviceSummaryResponse
- type DeleteDevicesResponse
- type DeleteGarbagesResponse
- type DeleteObjectsResponse
- type DeleteStepsResponse
- type DeleteTrailsResponse
- type Device
- func (device *Device) DeleteGarbages() (response DeleteGarbagesResponse)
- func (device *Device) MarkDeviceAsGarbage() (result bool, errs url.Values)
- func (device *Device) MarkDeviceSummaryGarbages() (response MarkDeviceSummaryResponse)
- func (device *Device) MarkUnClaimedDevicesAsGarbage() (response MarkUnclaimedDevicesResponse)
- func (device *Device) ProcessDeviceGarbages() (response ProcessDeviceGarbagesResponse)
- func (device *Device) Validate(r *http.Request) (result bool, errs url.Values)
- type MarkDeviceSummaryResponse
- type MarkTrailGarbagesResponse
- type MarkUnclaimedDevicesResponse
- type Object
- type PopulateStepsUsedObjectsResponse
- type PopulateTrailsUsedObjectsResponse
- type PopulateUsedObjectsResponse
- type ProcessDeviceGarbagesResponse
- type ProcessStepGarbagesResponse
- type ProcessTrailGarbagesResponse
- type Step
- type StepProgress
- type Trail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGarbageRemovalTime ¶
GetGarbageRemovalTime : Get Garbage Removal Time
func IsDeviceValid ¶
IsDeviceValid : to check if a DeviceID is valid or not
func IsObjectGarbage ¶
IsObjectGarbage : to check if an object is garbage or not
func IsObjectValid ¶
IsObjectValid : to check if an object is valid or not
func MergeErrors ¶
MergeErrors : Merge 2 arrays of Errors
Types ¶
type DeleteDeviceSummaryResponse ¶
type DeleteDeviceSummaryResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` DevicesRemoved int `json:"devices_removed"` Errors url.Values `json:"errors"` }
DeleteDeviceSummaryResponse : response of deleteDeviceSummaryGarbage() function
type DeleteDevicesResponse ¶
type DeleteDevicesResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` DevicesRemoved int `json:"devices_removed"` Errors url.Values `json:"errors"` }
DeleteDevicesResponse : response of deleteDeviceGarbage() function
type DeleteGarbagesResponse ¶
type DeleteGarbagesResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` Devices DeleteDevicesResponse `json:"devices"` DeviceSummary DeleteDeviceSummaryResponse `json:"device_summary"` Trails DeleteTrailsResponse `json:"trails"` Steps DeleteStepsResponse `json:"steps"` Objects DeleteObjectsResponse `json:"objects"` Errors url.Values `json:"errors"` }
DeleteGarbagesResponse : Response of DeleteGarbages() function
type DeleteObjectsResponse ¶
type DeleteObjectsResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` ObjectsRemoved int `json:"objects_removed"` Errors url.Values `json:"errors"` }
DeleteObjectsResponse : response of deleteAllObjectsGarbage() function
type DeleteStepsResponse ¶
type DeleteStepsResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` StepsRemoved int `json:"steps_removed"` Errors url.Values `json:"errors"` }
DeleteStepsResponse : response of deleteStepsGarbage() function
type DeleteTrailsResponse ¶
type DeleteTrailsResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` TrailsRemoved int `json:"trails_removed"` Errors url.Values `json:"errors"` }
DeleteTrailsResponse : response of deleteTrailGarbage() function
type Device ¶
type Device struct { ID primitive.ObjectID `json:"id" bson:"_id"` Prn string `json:"prn"` Nick string `json:"nick"` Owner string `json:"owner"` OwnerNick string `json:"owner-nick" bson:"-"` Secret string `json:"secret,omitempty"` TimeCreated time.Time `json:"time-created" bson:"timecreated"` TimeModified time.Time `json:"time-modified" bson:"timemodified"` Challenge string `json:"challenge,omitempty"` IsPublic bool `json:"public"` UserMeta map[string]interface{} `json:"user-meta" bson:"user-meta"` DeviceMeta map[string]interface{} `json:"device-meta" bson:"device-meta"` Garbage bool `json:"garbage" bson:"garbage"` GarbageRemovalAt time.Time `bson:"garbage_removal_at" json:"garbage_removal_at"` GcProcessed bool `json:"gc_processed" bson:"gc_processed"` }
Device : Device model
func (*Device) DeleteGarbages ¶
func (device *Device) DeleteGarbages() (response DeleteGarbagesResponse)
DeleteGarbages : Delete Garbages of a device
func (*Device) MarkDeviceAsGarbage ¶
MarkDeviceAsGarbage : Mark a device as garbage
func (*Device) MarkDeviceSummaryGarbages ¶
func (device *Device) MarkDeviceSummaryGarbages() (response MarkDeviceSummaryResponse)
MarkDeviceSummaryGarbages : Mark Deleted Devices As Garbage In DeviceSummary
func (*Device) MarkUnClaimedDevicesAsGarbage ¶
func (device *Device) MarkUnClaimedDevicesAsGarbage() (response MarkUnclaimedDevicesResponse)
MarkUnClaimedDevicesAsGarbage : Mark all unclaimed devices as garbage after a while(eg: after 5 days)
func (*Device) ProcessDeviceGarbages ¶
func (device *Device) ProcessDeviceGarbages() (response ProcessDeviceGarbagesResponse)
ProcessDeviceGarbages : Process Device Garbages
type MarkDeviceSummaryResponse ¶
type MarkDeviceSummaryResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` DevicesMarked int `json:"devices_marked"` Errors url.Values `json:"errors"` }
MarkDeviceSummaryResponse : response of MarkDeviceSummaryGarbages() function
type MarkTrailGarbagesResponse ¶
type MarkTrailGarbagesResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` TrailsMarked int `json:"trails_marked"` Errors url.Values `json:"errors"` }
MarkTrailGarbagesResponse : response of MarkAllTrailGarbages() function
func MarkAllTrailGarbages ¶
func MarkAllTrailGarbages() (response MarkTrailGarbagesResponse)
MarkAllTrailGarbages : Mark all trail garbages
type MarkUnclaimedDevicesResponse ¶
type MarkUnclaimedDevicesResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` DevicesMarked int `json:"devices_marked"` Errors url.Values `json:"errors"` }
MarkUnclaimedDevicesResponse : response of MarkUnClaimedDevicesAsGarbage() function
type Object ¶
type Object struct { ID string `json:"id" bson:"id"` StorageID string `json:"storage-id" bson:"_id"` Owner string `json:"owner"` ObjectName string `json:"objectname"` Sha string `json:"sha256sum"` Size string `json:"size"` SizeInt int64 `json:"sizeint"` MimeType string `json:"mime-type"` Garbage bool `json:"garbage" bson:"garbage"` GarbageRemovalAt time.Time `bson:"garbage_removal_at" json:"garbage_removal_at"` // contains filtered or unexported fields }
Object : Object model
type PopulateStepsUsedObjectsResponse ¶
type PopulateStepsUsedObjectsResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` StepsPopulated int `json:"steps_populated"` StepsWithErrors int `json:"steps_with_errors"` ObjectsUnMarkedAsGarbage []string `json:"objects_unmarked_as_garbage"` Errors url.Values `json:"errors"` }
PopulateStepsUsedObjectsResponse : Populate Steps Used Objects Response
type PopulateTrailsUsedObjectsResponse ¶
type PopulateTrailsUsedObjectsResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` TrailsPopulated int `json:"trails_populated"` TrailsWithErrors int `json:"trails_with_errors"` ObjectsUnMarkedAsGarbage []string `json:"objects_unmarked_as_garbage"` Errors url.Values `json:"errors"` }
PopulateTrailsUsedObjectsResponse : Populate Trails Used Objects Response
type PopulateUsedObjectsResponse ¶
type PopulateUsedObjectsResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` ObjectList []string `json:"object_list"` InvalidObjectCount int `json:"invalid_object_count"` InvalidState bool `json:"invalid_state"` ObjectsUnMarkedAsGarbage []string `json:"objects_unmarked_as_garbage"` Errors url.Values `json:"errors"` }
PopulateUsedObjectsResponse : Populate UsedObject Response
type ProcessDeviceGarbagesResponse ¶
type ProcessDeviceGarbagesResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` DeviceProcessed int `json:"device_processed"` TrailsMarkedAsGarbage int `json:"trails_marked_as_garbage"` TrailsWithErrors int `json:"trails_with_errors"` Errors url.Values `json:"errors"` }
ProcessDeviceGarbagesResponse : response of ProcessDeviceGarbages function
type ProcessStepGarbagesResponse ¶
type ProcessStepGarbagesResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` StepsProcessed int `json:"steps_processed"` ObjectsMarkedAsGarbage int `json:"objects_marked_as_garbage"` ObjectsWithErrors int `json:"objects_with_errors"` StepsWithErrors int `json:"steps_with_errors"` ObjectsIgnored int `json:"objects_ignored"` Errors url.Values `json:"errors"` Warnings url.Values `json:"warnings"` }
ProcessStepGarbagesResponse : Response of ProcessStepGarbages() function
type ProcessTrailGarbagesResponse ¶
type ProcessTrailGarbagesResponse struct { Status int `json:"status"` StatusMessage string `json:"status_message"` TrailsProcessed int `json:"trails_processed"` StepsMarkedAsGarbage int `json:"steps_marked_as_garbage"` ObjectsMarkedAsGarbage int `json:"objects_marked_as_garbage"` TrailsWithErrors int `json:"trails_with_errors"` ObjectsWithErrors int `json:"objects_with_errors"` ObjectsIgnored int `json:"objects_ignored"` StepsWithErrors int `json:"steps_with_errors"` Errors url.Values `json:"errors"` Warnings url.Values `json:"warnings"` }
ProcessTrailGarbagesResponse : response of ProcessTrailGarbages() function
type Step ¶
type Step struct { ID string `json:"id" bson:"_id"` // XXX: make type Owner string `json:"owner"` Device string `json:"device"` Committer string `json:"committer"` TrailID primitive.ObjectID `json:"trail-id" bson:"trail-id"` //parent id Rev int `json:"rev"` CommitMsg string `json:"commit-msg" bson:"commit-msg"` State map[string]interface{} `json:"state"` // json blurb StateSha string `json:"state-sha" bson:"statesha"` StepProgress StepProgress `json:"progress" bson:"progress"` StepTime time.Time `json:"step-time" bson:"step-time"` ProgressTime time.Time `json:"progress-time" bson:"progress-time"` Garbage bool `json:"garbage" bson:"garbage"` GarbageRemovalAt time.Time `bson:"garbage_removal_at" json:"garbage_removal_at"` GcProcessed bool `json:"gc_processed" bson:"gc_processed"` UsedObjects []string `bson:"used_objects" json:"used_objects"` }
step wanted can be added by the device owner or delegate. steps that were not reported can be deleted still. other steps cannot be deleted until the device gets deleted as well. Step: Step model
func (*Step) PopulateAllStepsUsedObjects ¶
func (step *Step) PopulateAllStepsUsedObjects() (response PopulateStepsUsedObjectsResponse)
PopulateAllStepsUsedObjects : Populate used_objects_field for all steps
func (*Step) ProcessStepGarbages ¶
func (step *Step) ProcessStepGarbages() (response ProcessStepGarbagesResponse)
ProcessStepGarbages : Process Step Garbages
type StepProgress ¶
type StepProgress struct { Progress int `json:"progress"` // progress number. steps or 1-100 StatusMsg string `json:"status-msg" bson:"statusmsg"` // message of progress status Status string `json:"status"` // status code Log string `json:"log"` // log if available }
StepProgress : StepProgress model
type Trail ¶
type Trail struct { ID primitive.ObjectID `json:"id" bson:"_id"` Owner string `json:"owner"` Device string `json:"device"` // Admins []string `json:"admins"` // XXX: maybe this is best way to do delegating device access.... LastInSync time.Time `json:"last-insync" bson:"last-insync"` LastTouched time.Time `json:"last-touched" bson:"last-touched"` FactoryState map[string]interface{} `json:"factory-state" bson:"factory-state"` Garbage bool `json:"garbage" bson:"garbage"` GarbageRemovalAt time.Time `bson:"garbage_removal_at" json:"garbage_removal_at"` GcProcessed bool `json:"gc_processed" bson:"gc_processed"` UsedObjects []string `bson:"used_objects" json:"used_objects"` }
Trail : Trail model
func (*Trail) PopulateAllTrailsUsedObjects ¶
func (trail *Trail) PopulateAllTrailsUsedObjects() (response PopulateTrailsUsedObjectsResponse)
PopulateAllTrailsUsedObjects : Populate used_objects_field for all trails
func (*Trail) ProcessTrailGarbages ¶
func (trail *Trail) ProcessTrailGarbages() (response ProcessTrailGarbagesResponse)
ProcessTrailGarbages : Process Trail Garbages