// New creates a new mongoDB lock for the provided session, db, collection and resource
New creates a new mongoDB lock for the provided session, db, collection and resource
// New creates a new mongoDB lock for the provided session db collection and resource
func New(ctx context.Context, mongoConnection *mongoDriver.MongoConnection, resource string) *Lock {
	lockClient := mongoConnection.C(fmt.Sprintf("%s_locks", resource)).NewLockClient()
	lockClient.CreateIndexes(ctx)
	lockPurger := lock.NewPurger(lockClient)
	lck := &Lock{
		Resource: resource,
	}
	lck.Init(ctx, lockClient, lockPurger)
	return lck
}
func New ( ctx context . Context , mongoConnection * mongoDriver . MongoConnection , resource string ) * Lock { lockClient := mongoConnection . C ( fmt . Sprintf ( " " , resource ) ) . NewLockClient ( ) lockClient . CreateIndexes ( ctx ) lockPurger := lock . NewPurger ( lockClient ) lck := & Lock { Resource : resource , } lck . Init ( ctx , lockClient , lockPurger ) return lck }
New creates a new mongoDB lock for the provided session, db, collection and resource
New creates a new mongoDB lock for the provided session db collection and resource