func (r *StateRestore) AllocRestore(alloc *structs.Allocation) error {
	// Set the shared resources if it's not present
	// COMPAT 0.4.1 -> 0.5
	if alloc.SharedResources == nil {
		alloc.SharedResources = &structs.Resources{
			DiskMB: alloc.Resources.DiskMB,
		}
	}

	// Create the EphemeralDisk if it's nil by adding up DiskMB from task resources.
	if alloc.Job != nil {
		r.addEphemeralDiskToTaskGroups(alloc.Job)
	}

	if err := r.txn.Insert("allocs", alloc); err != nil {
		return fmt.Errorf("alloc insert failed: %v", err)
	}
	return nil
}
// AllocRestore is used to restore an allocation
AllocRestore is used to restore an allocation
// AllocRestore is used to restore an allocation
func (r *StateRestore) AllocRestore(alloc *structs.Allocation) error {
	if alloc.SharedResources == nil {
		alloc.SharedResources = &structs.Resources{
			DiskMB: alloc.Resources.DiskMB,
		}
	}
	if alloc.Job != nil {
		r.addEphemeralDiskToTaskGroups(alloc.Job)
	}
	if err := r.txn.Insert("allocs", alloc); err != nil {
		return fmt.Errorf("alloc insert failed: %v", err)
	}
	return nil
}
func ( r * StateRestore ) AllocRestore ( alloc * structs . Allocation ) error { if alloc . SharedResources == nil { alloc . SharedResources = & structs . Resources { DiskMB : alloc . Resources . DiskMB , } } if alloc . Job != nil { r . addEphemeralDiskToTaskGroups ( alloc . Job ) } if err := r . txn . Insert ( " " , alloc ) ; err != nil { return fmt . Errorf ( " " , err ) } return nil }
AllocRestore is used to restore an allocation
AllocRestore is used to restore an allocation
// Set the shared resources if it's not present // COMPAT 0.4.1 -> 0.5 // Create the EphemeralDisk if it's nil by adding up DiskMB from task resources.