C# Class GitSharp.Core.LockFile

Git style file locking and replacement. To modify a ref file Git tries to use an atomic update approach: we write the new data into a brand new file, then rename it in place over the old name. This way we can just delete the temporary file if anything goes wrong, and nothing has been damaged. To coordinate access from multiple processes at once Git tries to atomically create the new temporary file under a well-known name.
Inheritance: IDisposable
Afficher le fichier Open project: jagregory/GitSharp Class Usage Examples

Méthodes publiques

Méthode Description
Commit ( ) : bool
CopyCurrentContent ( ) : void

Copy the current file content into the temporary file. This method saves the current file content by inserting it into the temporary file, so that the caller can safely append rather than replace the primary file. This method does nothing if the current file does not exist, or exists but is empty.

Dispose ( ) : void
GetOutputStream ( ) : Stream

Obtain the direct output stream for this lock. The stream may only be accessed once, and only after Lock() has been successfully invoked and returned true. Callers must close the stream prior to calling Commit() to commit the change.

Lock ( ) : bool

* Try to establish the lock.

LockFile ( FileInfo file ) : System

Create a new lock for any file.

LockForAppend ( ) : bool

Try to establish the lock for appending.

Unlock ( ) : void
Write ( ObjectId id ) : void
Write ( byte content ) : void

Private Methods

Méthode Description
RequireLock ( ) : void
SaveStatInformation ( ) : void

Method Details

Commit() public méthode

public Commit ( ) : bool
Résultat bool

CopyCurrentContent() public méthode

Copy the current file content into the temporary file. This method saves the current file content by inserting it into the temporary file, so that the caller can safely append rather than replace the primary file. This method does nothing if the current file does not exist, or exists but is empty.
/// The temporary file could not be written, or a read error /// occurred while reading from the current file. The lock is /// released before throwing the underlying IO exception to the /// caller. ///
public CopyCurrentContent ( ) : void
Résultat void

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GetOutputStream() public méthode

Obtain the direct output stream for this lock. The stream may only be accessed once, and only after Lock() has been successfully invoked and returned true. Callers must close the stream prior to calling Commit() to commit the change.
public GetOutputStream ( ) : Stream
Résultat Stream

Lock() public méthode

* Try to establish the lock.
/// the temporary output file could not be created. The caller /// does not hold the lock. ///
public Lock ( ) : bool
Résultat bool

LockFile() public méthode

Create a new lock for any file.
public LockFile ( FileInfo file ) : System
file System.IO.FileInfo the file that will be locked.
Résultat System

LockForAppend() public méthode

Try to establish the lock for appending.
/// The temporary output file could not be created. The caller /// does not hold the lock. ///
public LockForAppend ( ) : bool
Résultat bool

Unlock() public méthode

public Unlock ( ) : void
Résultat void

Write() public méthode

public Write ( ObjectId id ) : void
id ObjectId
Résultat void

Write() public méthode

public Write ( byte content ) : void
content byte
Résultat void