Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for ReplaceFile (0.14 sec)

  1. pkg/kubelet/kubeletconfig/util/files/files.go

    	return tmpPath, tmpFile.Sync()
    }
    
    // ReplaceFile replaces the contents of the file at `path` with `data` by writing to a tmp file in the same
    // dir as `path` and renaming the tmp file over `path`. The file does not have to exist to use ReplaceFile,
    // but the parent directory must exist.
    // Note ReplaceFile calls fsync.
    func ReplaceFile(fs utilfs.Filesystem, path string, data []byte) error {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Apr 13 01:02:46 UTC 2023
    - 7.5K bytes
    - Viewed (0)
  2. src/cmd/go/internal/robustio/robustio_flaky.go

    // rename is like os.Rename, but retries ephemeral errors.
    //
    // On Windows it wraps os.Rename, which (as of 2019-06-04) uses MoveFileEx with
    // MOVEFILE_REPLACE_EXISTING.
    //
    // Windows also provides a different system call, ReplaceFile,
    // that provides similar semantics, but perhaps preserves more metadata. (The
    // documentation on the differences between the two is very sparse.)
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 28 18:17:57 UTC 2021
    - 2.5K bytes
    - Viewed (0)
  3. pkg/kubelet/kubeletconfig/util/files/files_test.go

    // Note: This transitively tests WriteTmpFile
    func TestReplaceFile(t *testing.T) {
    	fn := func(fs utilfs.Filesystem, dir string, c *test) []error {
    		var errs []error
    		for _, f := range c.expects {
    			if err := ReplaceFile(fs, filepath.Join(dir, f.name), []byte(f.data)); err != nil {
    				errs = append(errs, err)
    			}
    		}
    		return errs
    	}
    	cases := []test{
    		{
    			fn:      fn,
    			desc:    "file exists",
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Dec 07 11:36:13 UTC 2022
    - 11.7K bytes
    - Viewed (0)
  4. pkg/kubelet/kubeletconfig/configfiles/configfiles_test.go

    	return &s
    }
    
    func addFile(fs utilfs.Filesystem, path string, file string) error {
    	if err := utilfiles.EnsureDir(fs, filepath.Dir(path)); err != nil {
    		return err
    	}
    	return utilfiles.ReplaceFile(fs, path, []byte(file))
    }
    
    func newConfig(t *testing.T) *kubeletconfig.KubeletConfiguration {
    	kubeletScheme, _, err := kubeletscheme.NewSchemeAndCodecs()
    	if err != nil {
    		t.Fatalf("unexpected error: %v", err)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 18 12:18:41 UTC 2023
    - 7.2K bytes
    - Viewed (0)
Back to top