/*
Create Packet from passed message array
*/
func CreatePacket(packet_array []string) Packet {
	packet := Packet{}
	packet.HashMap = make(golhashmap.HashMap)

	packet.DBAction = packet_array[0]
	packet.TaskType = packet_array[1]
	data_starts_from := 2

	task_type_tokens := strings.Split(packet.TaskType, "-")
	packet.KeyType = task_type_tokens[0]
	if packet.KeyType == "tsds" && packet.DBAction == "push" {
		packet.TimeDot = goltime.CreateTimestamp(packet_array[2:8])
		data_starts_from += 6
	}

	if len(task_type_tokens) > 1 {
		packet.ValType = task_type_tokens[1]

		if len(task_type_tokens) == 3 {
			// if packet requirement grows more than 3, that's the limit
			// go get 'msgpack' to handle it instead...
			thirdTokenFeature(&packet, packet_array, &data_starts_from, task_type_tokens[2])
		}
	}

	decodeData(&packet, packet_array[data_starts_from:])
	return packet
}
/* handles single-Item; delegates multi-item */
func PushKeyValSolo(task_type string, key string, value string, message_array *[]string) bool {
	switch task_type {
	case "tsds":
		timestamp := goltime.CreateTimestamp((*message_array)[0:6])
		return PushKeyValTSDS(key, value, timestamp)

	case "now":
		return PushKeyValNowTSDS(key, value)

	case "ns":
		return PushKeyValNS(key, value)

	default:
		return PushKeyVal(key, value)

	}
}