github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/libdokan/special_files.go (about)

     1  // Copyright 2016 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package libdokan
     6  
     7  import (
     8  	"github.com/keybase/client/go/kbfs/dokan"
     9  	"github.com/keybase/client/go/kbfs/libfs"
    10  )
    11  
    12  // handleTLFSpecialFile handles special files that are within a TLF.
    13  func handleTLFSpecialFile(name string, folder *Folder) dokan.File {
    14  	// Common files (the equivalent of handleCommonSpecialFile
    15  	// from libfuse) are handled in fs.go.
    16  	switch name {
    17  	case libfs.EditHistoryName:
    18  		return NewTlfEditHistoryFile(folder)
    19  
    20  	case libfs.UnstageFileName:
    21  		return &UnstageFile{
    22  			folder: folder,
    23  		}
    24  
    25  	case libfs.DisableUpdatesFileName:
    26  		return &UpdatesFile{
    27  			folder: folder,
    28  		}
    29  
    30  	case libfs.EnableUpdatesFileName:
    31  		return &UpdatesFile{
    32  			folder: folder,
    33  			enable: true,
    34  		}
    35  
    36  	case libfs.RekeyFileName:
    37  		return &RekeyFile{
    38  			folder: folder,
    39  		}
    40  
    41  	case libfs.ReclaimQuotaFileName:
    42  		return &ReclaimQuotaFile{
    43  			folder: folder,
    44  		}
    45  
    46  	case libfs.SyncFromServerFileName:
    47  		return &SyncFromServerFile{
    48  			folder: folder,
    49  		}
    50  
    51  	case libfs.EnableJournalFileName:
    52  		return &JournalControlFile{
    53  			folder: folder,
    54  			action: libfs.JournalEnable,
    55  		}
    56  
    57  	case libfs.FlushJournalFileName:
    58  		return &JournalControlFile{
    59  			folder: folder,
    60  			action: libfs.JournalFlush,
    61  		}
    62  
    63  	case libfs.PauseJournalBackgroundWorkFileName:
    64  		return &JournalControlFile{
    65  			folder: folder,
    66  			action: libfs.JournalPauseBackgroundWork,
    67  		}
    68  
    69  	case libfs.ResumeJournalBackgroundWorkFileName:
    70  		return &JournalControlFile{
    71  			folder: folder,
    72  			action: libfs.JournalResumeBackgroundWork,
    73  		}
    74  
    75  	case libfs.DisableJournalFileName:
    76  		return &JournalControlFile{
    77  			folder: folder,
    78  			action: libfs.JournalDisable,
    79  		}
    80  
    81  	case libfs.EnableSyncFileName:
    82  		return &SyncControlFile{
    83  			folder: folder,
    84  			action: libfs.SyncEnable,
    85  		}
    86  
    87  	case libfs.DisableSyncFileName:
    88  		return &SyncControlFile{
    89  			folder: folder,
    90  			action: libfs.SyncDisable,
    91  		}
    92  	}
    93  
    94  	return nil
    95  }