func NewFileRemovalPolicy(
	rootPath string,
	outdatedFileDayCount int,
	telemetry FileRemovalPolicyTelemetry) (*FileRemovalPolicy, error) {
	if err := os.MkdirAll(rootPath, 0700); err != nil {
		return nil, err
	}

	permission, err := filesystem.NewPermission()
	if err != nil {
		return nil, err
	}
	if err := permission.RestrictAccessToUser(rootPath); err != nil {
		return nil, err
	}

	telemetry.addNewRemovalPolicyCount()

	return &FileRemovalPolicy{
		rootPath:           rootPath,
		knownDomainFolders: make(map[string]struct{}),
		outdatedFileTime:   time.Now().Add(time.Duration(-outdatedFileDayCount*24) * time.Hour),
		telemetry:          telemetry,
	}, nil
}
// NewFileRemovalPolicy creates a new instance of FileRemovalPolicy
NewFileRemovalPolicy creates a new instance of FileRemovalPolicy
// NewFileRemovalPolicy creates a new instance of FileRemovalPolicy
func NewFileRemovalPolicy(
	rootPath string,
	outdatedFileDayCount int,
	telemetry FileRemovalPolicyTelemetry) (*FileRemovalPolicy, error) {
	if err := os.MkdirAll(rootPath, 0700); err != nil {
		return nil, err
	}
	permission, err := filesystem.NewPermission()
	if err != nil {
		return nil, err
	}
	if err := permission.RestrictAccessToUser(rootPath); err != nil {
		return nil, err
	}
	telemetry.addNewRemovalPolicyCount()
	return &FileRemovalPolicy{
		rootPath:           rootPath,
		knownDomainFolders: make(map[string]struct{}),
		outdatedFileTime:   time.Now().Add(time.Duration(-outdatedFileDayCount*24) * time.Hour),
		telemetry:          telemetry,
	}, nil
}
func NewFileRemovalPolicy ( rootPath string , outdatedFileDayCount int , telemetry FileRemovalPolicyTelemetry ) ( * FileRemovalPolicy , error ) { if err := os . MkdirAll ( rootPath , 0700 ) ; err != nil { return nil , err } permission , err := filesystem . NewPermission ( ) if err != nil { return nil , err } if err := permission . RestrictAccessToUser ( rootPath ) ; err != nil { return nil , err } telemetry . addNewRemovalPolicyCount ( ) return & FileRemovalPolicy { rootPath : rootPath , knownDomainFolders : make ( map [ string ] struct { } ) , outdatedFileTime : time . Now ( ) . Add ( time . Duration ( - outdatedFileDayCount * 24 ) * time . Hour ) , telemetry : telemetry , } , nil }
NewFileRemovalPolicy creates a new instance of FileRemovalPolicy
NewFileRemovalPolicy creates a new instance of FileRemovalPolicy