-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from MinaFoundation/s3-fallback
PM-1343 S3 fallback
- Loading branch information
Showing
10 changed files
with
257 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/aws-sdk-go-v2/service/s3" | ||
"github.com/gocql/gocql" | ||
logging "github.com/ipfs/go-log/v2" | ||
) | ||
|
||
// AppContext holds shared resources and configurations. | ||
type AppContext struct { | ||
CassandraSession *gocql.Session | ||
S3Session *s3.Client | ||
Log *logging.ZapEventLogger | ||
} | ||
|
||
// NewAppContext creates a new context with the necessary components. | ||
func NewAppContext(ctx context.Context, cassandraConfig *CassandraConfig, awsConfig *AwsConfig, log *logging.ZapEventLogger) (*AppContext, error) { | ||
cassandraSession, err := InitializeCassandraSession(cassandraConfig) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
s3Session, err := InitializeS3Session(ctx, awsConfig.Region) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &AppContext{ | ||
CassandraSession: cassandraSession, | ||
Log: log, | ||
S3Session: s3Session, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.