On the q-analog of homological algebra