1
1
import IDrive from './gateways/IDrive'
2
2
import IHash from './gateways/IHash'
3
- import BlobRepositoryImpl from './repositories/implementations/LocalBlobRepository'
3
+ import LocalBlobRepository from './repositories/implementations/LocalBlobRepository'
4
4
import IBlobRepository from './repositories/IBlobRepository'
5
5
import IObjectRepository from './repositories/IObjectRepository'
6
- import ObjectRepositoryImpl from './repositories/implementations/LocalObjectRepository'
6
+ import LocalObjectRepository from './repositories/implementations/LocalObjectRepository'
7
7
import CatFileUseCase from './use-cases/CatFileUseCase'
8
8
import HashFileUseCase from './use-cases/HashFileUseCase'
9
9
import InitUseCase from './use-cases/InitUseCase'
@@ -12,12 +12,23 @@ export default class ChronoApp {
12
12
private readonly objectRepository : IObjectRepository
13
13
private readonly blobRepository : IBlobRepository
14
14
15
+ private readonly objectTemporaryRepository : IObjectRepository
16
+ private readonly blobTemporaryRepository : IBlobRepository
17
+
15
18
constructor (
16
19
private readonly drive : IDrive ,
17
20
private readonly hash : IHash
18
21
) {
19
- this . objectRepository = new ObjectRepositoryImpl ( drive , hash )
20
- this . blobRepository = new BlobRepositoryImpl ( drive , hash )
22
+ this . objectRepository = new LocalObjectRepository ( drive , hash )
23
+ this . blobRepository = new LocalBlobRepository ( drive , hash )
24
+
25
+ this . objectTemporaryRepository = new LocalObjectRepository (
26
+ drive ,
27
+ hash ,
28
+ '.chrono/tmp/objects'
29
+ )
30
+
31
+ this . blobTemporaryRepository = new LocalBlobRepository ( drive , hash , '.chrono/tmp/blobs' )
21
32
}
22
33
23
34
public async init ( ) {
@@ -27,13 +38,17 @@ export default class ChronoApp {
27
38
}
28
39
29
40
public async hashFile ( path : string ) {
30
- const useCase = new HashFileUseCase ( this . drive , this . objectRepository , this . blobRepository )
41
+ const useCase = new HashFileUseCase (
42
+ this . drive ,
43
+ this . objectTemporaryRepository ,
44
+ this . blobTemporaryRepository
45
+ )
31
46
32
47
return useCase . execute ( { path } )
33
48
}
34
49
35
50
public async catFile ( objectHash : string ) {
36
- const useCase = new CatFileUseCase ( this . objectRepository )
51
+ const useCase = new CatFileUseCase ( this . objectTemporaryRepository )
37
52
38
53
return useCase . execute ( { objectHash } )
39
54
}
0 commit comments